您可以创建<div class="quick-holder"></div>
每个注释末尾的容器,并复制(&M);在上面放置评论表单<div>
通过jQuery。
单击可启用的隐藏表单Reply
链接
<form action="<?php echo get_option(\'siteurl\'); ?>/wp-comments-post.php" method="post" id="commentform-a" class="hidden absolute">
..
</form>
jQuery
// QUICK REPLY FORM
var hForm_a = p(\'#commentform-a\').outerHeight(true) + 15 + 25 + 25; // paddings & margin
p(\'a.quick-reply\').click(function(){
var
id = p(this).attr(\'title\'),
form = p(\'#commentform-a\'),
author = p(\'#author-\'+id).html();
form.find(\'#to-author\').html(author);
form.removeClass(\'hidden absolute\');
// form.remove();
p(\'.cancel-reply\').addClass(\'none\');
// Hide major form
p(\'#commentform\').stop(true, false).animate({height: 0, opacity: 0}, 500, function(){
p(this).addClass(\'hidden absolute\').css({height: \'auto\'});
p(\'#review-label\').removeClass(\'none\');
});
// Close all .quick-holder\'s
p(\'.quick-holder\').stop(true, false).animate({height: 0}, 500);
// Put the form to the holder
p(\'#comment-\'+id).find(\'.quick-holder:eq(0)\').append(form).animate({height: hForm_a}, 500, function(){
p(this).css({height: \'auto\'});
p(\'#comment-\'+id).find(\'.cancel-reply:eq(0)\').removeClass(\'none\');
});
// Set an ID for hidden field
p(\'#comment_parent\').val(id);
return false;
})
// Cancel reply
p(\'.cancel-reply\').click(function(){
var hForm = p(\'#commentform\').outerHeight(true);
// Display major form
p(\'#commentform\').removeClass(\'hidden absolute\').stop(true, false).animate({height: hForm, opacity: 1}, 1000, function(){ p(this).css({height: \'auto\'}) });
p(\'.cancel-reply\').addClass(\'none\');
p(\'#commentform-a\').addClass(\'hidden absolute\');
// Close all .quick-holder\'s
p(\'.quick-holder\').css({height: 0});
return false;
})