This is the script to show / hide me on the main page of my blog:
< Code> & lt; Script type = "text / javascript" & gt; // show / hide comments jquery (document) .ready (function () {// go #comments div var uniqueAppend = 1; var tempName = 'comments'; while (jQuery ("# comments"). Length & gt; ; 0) (Hide "Comment" for JQuery if (commentsDiv.length) {// Hide jQuery (commentsDiv) by default #comments div, .hide (); // Add a link to show / hide ('& Lt; a / & gt; ') .attr (' class', 'toggle-comments') .attr (' href ',' # ') .html (' notes') .includerAdvanced (commentsDiv); // In the dialog button, toggle-comment-container DIV jQuery ('. Toggle-comments ()). Wrap (jQuery (' 'The problem is that when I press the Open all post comments button at the same time. I just want to open the comments of the button that I suppress. If someone can help me then I would be very thankful and best regards
Alberto
In the following lines, selectors will have to correct your problem -
Problem
var commentContainer = jQuery (this). Parent ('toggle-comments-container'). Siblings ('.commentContainer'); Var anchor = jquery (commentContainer) .siblings ('toggle-comment-container'). Children ('toggle-comments');
Solution
var commentContainer = jQuery (this). Parent (). Prev (); Var anchor = jQuery (commentContainer) .next (). Children ('toggle-comments');
The problem occurs with the use of .siblings () which matches all the elements of the same class name and thus all your comment nodes Selects.
fadeToggle
can give you a better visual experience by usingslideToggle
instead (this line is just a design suggestion Answer)
Comments
Post a Comment