Search Results

Search found 2 results on 1 pages for 'tg4fsi'.

Page 1/1 | 1 

  • How to use "this" and not "this" selectors in jQuery

    - by tg4FSI
    I have 4 divs with content like below: <div class="prodNav-Info-Panel">content</div> <div class="prodNav-Usage-Panel">content</div> <div class="prodNav-Guarantee-Panel">content</div> <div class="prodNav-FAQ-Panel">content</div> And a navigation list like this: <div id="nav"> <ul id="navigation"> <li><a class="prodNav-Info" ></a></li> <li><a class="prodNav-Usage" ></a></li> <li><a class="prodNav-Guarantee"></a></li> <li><a class="prodNav-FAQ" ></a></li> </ul> </div> When the page is first displayed I show all the content by executing this: $('div.prodNav-Usage-Panel').fadeIn('slow'); $('div.prodNav-Guarantee-Panel').fadeIn('slow'); $('div.prodNav-FAQ-Panel').fadeIn('slow'); $('div.prodNav-Info-Panel').fadeIn('slow'); Now, when you click the navigation list item it reveals the clicked content and hides the others, like this: $('.prodNav-Info').click( function() { $('div.prodNav-Info-Panel').fadeIn('slow'); $('div.prodNav-Usage-Panel').fadeOut('slow'); $('div.prodNav-Guarantee-Panel').fadeOut('slow'); $('div.prodNav-FAQ-Panel').fadeOut('slow'); }); So what I have is 4 separate functions because I do not know which content is currently displayed. I know this is inefficient and can be done with a couple of lines of code. It seems like there is a way of saying: when this is clicked, hide the rest. Can I do this with something like $(this) and $(not this)? Thanks, Erik

    Read the article

  • How to use "this" and not "this" selectors in qQuery

    - by tg4FSI
    I have 4 divs with content like below: <div class="prodNav-Info-Panel">content</div> <div class="prodNav-Usage-Panel">content</div> <div class="prodNav-Guarantee-Panel">content</div> <div class="prodNav-FAQ-Panel">content</div> And a navigation list like this: <div id="nav"> <ul id="navigation"> <li><a class="prodNav-Info" ></a></li> <li><a class="prodNav-Usage" ></a></li> <li><a class="prodNav-Guarantee"></a></li> <li><a class="prodNav-FAQ" ></a></li> </ul> </div> When the page is first displayed I show all the content by executing this: $('div.prodNav-Usage-Panel').fadeIn('slow'); $('div.prodNav-Guarantee-Panel').fadeIn('slow'); $('div.prodNav-FAQ-Panel').fadeIn('slow'); $('div.prodNav-Info-Panel').fadeIn('slow'); Now, when you click the navigation list item it reveals the clicked content and hides the others, like this: $('.prodNav-Info').click( function() { $('div.prodNav-Info-Panel').fadeIn('slow'); $('div.prodNav-Usage-Panel').fadeOut('slow'); $('div.prodNav-Guarantee-Panel').fadeOut('slow'); $('div.prodNav-FAQ-Panel').fadeOut('slow'); }); So what I have is 4 separate functions because I do not know which content is currently displayed. I know this is inefficient and can be done with a couple of lines of code. It seems like there is a way of saying: when this is clicked, hide the rest. Can I do this with something like $(this) and $(not this)? Thanks, Erik

    Read the article

1