게시판 댓글에 답변 달기
게시판 댓글에 답변을 달려고 답변을 눌렀다가 답변을 안쓰고
원글에 답변을 달려고 하면 댓글입력폼이 원상복구 되지 않아 새로고침을 해야 하는 번거로움이 있어서
view_comment.skin.php 파일을 좀 수정했습니다.
수정된 게시판 테스트 주소
http://work.wwiz.kr/free
//게시판 댓글 답변 수정 버튼 수정-->
--data-cmtid, data-cmtkind 추가
<?php if ($list[$i]['is_reply']) { ?><span class="cmt-vc-icon cmt-icon-write" data-cmtid="<?php echo $comment_id ?>" data-cmtkind="c">답변</span><?php } ?>
<?php if ($list[$i]['is_edit']) { ?><span class="cmt-vc-icon cmt-icon-write" data-cmtid="<?php echo $comment_id ?>" data-cmtkind="cu">수정</span><?php } ?>
댓글목록 부분에
<div id="cf_<?php echo $comment_id?>"></div> <--추가된 부분
<input type="hidden" value="<?php echo strstr($list[$i]['wr_option'],"secret") ?>" id="secret_comment_<?php echo $comment_id ?>">
<textarea id="save_comment_<?php echo $comment_id ?>" style="display:none"><?php echo get_text($list[$i]['content1'], 0) ?></textarea>
<--js 스크립트 추가-->
$('.cmt-icon-write').on("click",function(){
var $this = $(this),
cmtid = $this.data('cmtid'),
work = $this.data('cmtkind'),
wf = $('#bo_vc_w');
if($this.hasClass('cmt-icon-open') === true) {
$('#w').val('c');
$('#comment_id').val('');
document.getElementById('wr_content').value = '';
document.getElementById('wr_secret').checked = false;
$this.removeClass('cmt-icon-open');
$('#bo_vc').after($(wf));
return false;
}
if(work == 'cu') {
document.getElementById('wr_content').value = document.getElementById('save_comment_' + cmtid).value;
if (typeof char_count != 'undefined') {
check_byte('wr_content', 'char_count');
}
if (document.getElementById('secret_comment_'+cmtid).value) {
document.getElementById('wr_secret').checked = true;
} else {
document.getElementById('wr_secret').checked = false;
}
} else {
document.getElementById('wr_content').value = '';
document.getElementById('wr_secret').checked = false;
}
$('.cmt-icon-write').removeClass('cmt-icon-open');
$this.addClass('cmt-icon-open');
$('#w').val(work);
$('#comment_id').val(cmtid);
$('#cf_'+cmtid).append($(wf));
});
댓글 5개
https://ye-ah.net/coding/3
간단하게 그누보드 함수인 comment_box를 통해 취소할수있습니다
게시글 목록
| 번호 | 제목 |
|---|---|
| 24318 | |
| 24317 | |
| 24315 | |
| 24309 | |
| 24294 | |
| 24293 | |
| 24277 | |
| 24262 | |
| 24260 | |
| 24253 | |
| 24251 | |
| 24236 | |
| 24233 | |
| 24228 | |
| 24226 | |
| 24221 | |
| 24214 | |
| 24203 | |
| 24201 | |
| 24199 | |
| 24196 | |
| 24195 | |
| 24194 | |
| 24192 | |
| 24191 | |
| 24187 | |
| 24185 | |
| 24183 | |
| 24172 | |
| 24168 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기