toggle menu, where menu item is the content


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //if clicked item is already selected, ignore the click
  2. /* if($(this).hasClass('selected')){
  3. $(this).find('div').hide(300).end().animate({'width' : "200", 'height' : "200"}, 200).removeClass('selected').find("p.thumb").show();
  4. return;
  5. }
  6.  
  7. /*
  8. if ($('h1').is(':visible')) {
  9. $('h1').hide();
  10. } else {
  11. $('h1').show();
  12. }
  13.   */
  14.  
  15. //if an item in the menu is selected, close it, hide children, remove selected
  16. /* $("#grid li.selected").find('div').hide(200).end().animate({'width' : "200", 'height' : "200"}, 300).removeClass('selected').find("p.thumb").show();
  17. */
  18. //open the clicked item // add the 'selected' class in order to know what was opened for the next click
  19.  
  20.  
  21.  
  22.  
  23. $(this).find("p.thumb").hide().end().find('div').show(300).end().animate({width: "900", height: "660"}, 300).addClass('selected');
  24.  
  25. //add the 'selected' class in order to know what was opened for the next click
  26. /*$(this).addClass('selected');*/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.