Results 1 to 2 of 2

Thread: JQuery Menu Help!

  1. #1
    New Member
    Join Date
    Aug 12
    Posts
    1

    Unhappy JQuery Menu Help!

    when i click on the picture as my menu icon it will slide down but now i want it to slide when i click it again any help please

    Code:
    <!DOCTYPE html>
     <html lang="en">
    <head>
      <meta charset="utf-8" />
      <title>test</title>
      <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0" /> 
      <link rel="stylesheet" media="all" href="style.css" type="text/css">
    </head>
    
    <body onLoad="if (typeof jQuery == 'undefined') {  
    }">
      <div class="wrap">
        <header>
          <div class="logo"><a href="index.htm"><img src="images/logo.png" alt="logo"/></a></div>
          <div class="options">
          	<ul>
          		<li>Menu</li>
          	</ul>
          </div>
    	  
    	    	<div class="clear"></div>
    	    </div>
    	    <nav class="vertical menu">
    	    	<ul>
    			<div 
    	
    		
    	            <a href="index.htm">homepage</a> |
    	            <a href="forum.htm">forum</a> |
    	            <a href=contact.htm"">contact</a> |
    	
            	</ul>
    			
    	    </nav>
        </header>
            
        <div class="content">
    
    
    	
    	News Content Here
    
    
    
        </div>
    	
    	
        <footer>
        	<p>&copy; test
        </footer>
      </div>
     
    <script src="js/jquery.min.js"></script>
    <script type="text/javascript">
       window.addEventListener("load",function() {
    	  // Set a timeout...
    	  setTimeout(function(){
    	    // Hide the address bar!
    	    window.scrollTo(0, 1);
    	  }, 0);
    	});
       $('.menu' ).hide();   
       $('.options li:first-child').click(function(){	
       		$(this).toggleClass('active'); 	     			
       		$('.menu').hide();		
       		$('.options li:last-child').removeClass('active'); 
       });
        	    
       $('.options li:last-child').click(function(){
       		$(this).toggleClass('active');      			
       		$('.menu').toggle();  		
       		$('.options li:first-child').removeClass('active'); 
    		   });
        
       $('.content').click(function(){
       
       		$('.options li:last-child, .options li:first-child').removeClass('active');
    	
    		
    		
       });
      
       
     
    </script>
    </body>
    
    </html>

  2. #2
    Member
    Join Date
    Jul 10
    Posts
    63

    Re: JQuery Menu Help!

    I assume that you want to slide it back up if its down?
    maybe you can check if the element is visible by using

    if($("Element").is(":visible"))
    //SlideUp
    else
    //SlideDown

Posting Permissions

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