댓글 옵션창 똑같은 버튼 눌러서 닫는 방법 채택완료
그누보드 데모 사이트에서
아래 빨간 동그라미 친 버튼을 누르면 "답변"이라는 옵션창이 나오는데
다시 빨간 동그라미 친 버튼을 눌렀을 때 그 옵션창이 닫히지가 않습니다.

아래 코드가 관련 부분인데 아래 코드를 어떻게 수정해야 동일 버튼을 눌렀을 때 옵션창이 닫히게 설정할 수 있을까요? ㅠㅠ
Copy
// 댓글 옵션창 열기
$(".btn_cm_opt").on("click", function(){
$(this).parent("div").children(".bo_vc_act").show();
});
// 댓글 옵션창 닫기
$(document).mouseup(function (e){
var container = $(".bo_vc_act");
if( container.has(e.target).length === 0)
container.hide();
});
데모 사이트 : https://demo.sir.kr/gnuboard5/bbs/board.php?bo_table=n_gallery&wr_id=12
답변 1개
채택된 답변
+20 포인트
1년 전
Copy
...
jQuery(function($) {
//댓글열기
$(".cmt_btn").click(function(e){
e.preventDefault();
$(this).toggleClass("cmt_btn_op");
$("#bo_vc").toggle();
});
// --------------------------------------- 댓글 옵션창 열기/닫기 재정의
$(".btn_cm_opt").off("click");
$(document).off('mouseup');
// 댓글 옵션창 열기
$(".btn_cm_opt").on("click", function(){
//$(this).parent("div").children(".bo_vc_act").show();
$(this).parent("div").children(".bo_vc_act").toggle();
});
// 댓글 옵션창 닫기
$(document).mouseup(function (e){
var container = $(".bo_vc_act");
// if( container.has(e.target).length === 0)
if( container.parent('div').has(e.target).length === 0)
container.hide();
});
// --------------------------------------- 댓글 옵션창 열기/닫기 재정의
});
...
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인