Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    38
    Thanks
    5
    Thanked 0 Times in 0 Posts

    How to make a jquery slide script work uniquely on multiple none unique divs?

    I'm trying to use a jquery script on a social networking website I'm developing so the users can reply to comments left on their profile. The comment will display and below it it will say "Reply to this comment". When this is clicked the div will slide down with a form in it to reply with. The problem being all the scripts that I can find work just once on every page. If a persons profile already had multiple comments the script wont work properly.

    How can the script be modified so when clicking "Reply to this comment" under the specified comment it will make the div slide down under that comment and not just the first one.

    The script I'm using:

    http://www.webdesignerwall.com/demo/...ide-panel.html

    Thanks
    Last edited by Tomi; 03-12-2009 at 12:26 AM.

  • #2
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts

    Exclamation

    The link you're giving doesn't work (Instead it leads to a site that looks a bit fishy... unless of course that was the intention to begin with). Also, it would help to see exactly how the specific comments are generated, because I personally doubt it would work just by altering the plug-in without knowing the structure of your website.

  • #3
    New Coder
    Join Date
    Jul 2008
    Posts
    38
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Sorry wrong link it's actually: http://www.webdesignerwall.com/demo/...ide-panel.html

    I can't show you the structure of the site just yet as the php is still being coded but when its done ill put it up here.

  • #4
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    Not really a whole lot of script there:

    Code:
    $(document).ready(function(){
    
    	$(".btn-slide").click(function(){
    		$("#panel").slideToggle("slow");
    		$(this).toggleClass("active"); return false;
    	});
    	
    	 
    });
    Can easily be altered, but once again... we do need to see some HTML mark-up and how your divs or whatever are generated. Do they have a class? Are they child elements of others, etc, etc. It does help knowing the structure. For instance, if we're talking about a sibling, rather than a child element, it would be something like:

    Code:
    $("~ *" + this + ":not(visible)").slideToggle("slow"); // not 100% sure about the selector and a bit too late right now to test, so... forgive me if it's not exact.
    But this is just a guess without site structure...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •