新的一级评论的回复按钮,多次点击会打开多个回复输入框;我的解决方案是将
if (option.add != "") {
obj = option.add;
var str = crateCommentInfo(obj);
$(this).prepend(str).find(".reply-btn").click(function() {
replyClick($(this));
});
}中注册监听部分改为
$(this).prepend(str).find(".reply-btn").off('click').click(function() {
if ($(this).parent().parent().find(".replybox").length > 0) {
$(".replybox").remove();
} else {
$(".replybox").remove();
replyClick($(this));
}
});
在点击上面的评论时,再点击下面的回复,会出现两个输入框的问题是在于//添加新数据
if (option.add != "") {
obj = option.add;
var str = crateCommentInfo(obj);
$(this).prepend(str).find(".reply-btn").click(function() {
replyClick($(this));
});
}这段代码又对按钮进行了绑定操作,所以,会触发两次!!!
我的解决办法是自己评论的就不出现回复按钮,所以就不存在这样的问题了