Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Multiple Jquery toggle function not working!

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #168770
    Niplo
    Participant

    Hi!

    I want to write a function that will show hide a div (containing project credits), for multiple projects on a single page. So far I’ve had to make them all different.

    Here’s what I got (click credits):
    MY DEMO

    If anyone knows of a way to simplify this I would be really appreciative!

    Thanks!
    -Niplo.

    #168771
    Paulie_D
    Member

    Could you make a reduced example case in Codepen.io

    This doesn’t sound like a huge issue…it’s just a case of using a class, toggling and $(this) in Jquery.

    #168775
    Alan C
    Participant

    Yea just use $(this) and then have it match 2 identifiers that show the content and the link are related. Could be anything from a class to an ID or even a data attribute.

    #168907
    Niplo
    Participant

    Thanks for the responses, definitely got me on the right track!

    I got this to work:

    
    $(document).ready(function(){
        jQuery('.InfoDisplay').click( function() {
          $(this).next('#Info').fadeToggle();
          return false;
        });
    });
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.