Results 1 to 2 of 2
  1. #1
    chronoare is offline Member
    Join Date
    Sep 2011
    Posts
    1
    Rep Power
    0

    Default Show/Hide menu with Java

    Hi from Sweden,


    I have a problem, a friend have a js script to show/hide menu on a page. We want the menu to be visible at all time. Now it only appears when hoovering the pointer over it.

    Would be great with some feedback as I am new to javascript and mainly work in php, xhtml.

    Java Code:
    $j.fn.setNav = function(){
    	$j('#main_menu li ul').css({display: 'none'});
    
    	$j('#main_menu li').each(function()
    	{	
    		var $jsublist = $j(this).find('ul:first');
    		
    		$j(this).hover(function()
    		{	
    			$jsublist.css({opacity: 1});
    			
    			$jsublist.stop().css({overflow:'hidden', height:'auto', display:'none'}).fadeIn(200, function()
    			{
    				$j(this).css({overflow:'visible', height:'auto', display: 'block'});
    			});	
    		},
    		function()
    		{	
    			$jsublist.stop().css({overflow:'hidden', height:'auto', display:'none'}).fadeOut(200, function()
    			{
    				$j(this).css({overflow:'hidden', display:'none'});
    			});	
    		});	
    		
    	});
    	
    	$j('#main_menu li').each(function()
    	{
    		
    		$j(this).hover(function()
    		{	
    			$j(this).find('a:first').addClass('hover');
    		},
    		function()
    		{	
    			$j(this).find('a:first').removeClass('hover');
    		});	
    		
    	});
    	
    	$j('#menu_wrapper .nav ul li ul').css({display: 'none'});
    
    	$j('#menu_wrapper .nav ul li').each(function()
    	{	
    		
    		var $jsublist = $j(this).find('ul:first');
    		
    		$j(this).hover(function()
    		{	
    			$jsublist.css({opacity: 1});
    			
    			$jsublist.stop().css({overflow:'hidden', height:'auto', display:'none'}).fadeIn(200, function()
    			{
    				$j(this).css({overflow:'visible', height:'auto', display: 'block'});
    			});	
    		},
    		function()
    		{	
    			$jsublist.stop().css({overflow:'hidden', height:'auto', display:'none'}).fadeOut(200, function()
    			{
    				$j(this).css({overflow:'hidden', display:'none'});
    			});	
    		});	
    		
    	});
    	
    	$j('#menu_wrapper .nav ul li').each(function()
    	{
    		
    		$j(this).hover(function()
    		{	
    			$j(this).find('a:first').addClass('hover');
    		},
    		function()
    		{	
    			$j(this).find('a:first').removeClass('hover');
    		});

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,616
    Rep Power
    25

    Default Re: Show/Hide menu with Java

    This is a java forum. Try asking your question on a javascript forum.

Similar Threads

  1. Replies: 11
    Last Post: 09-18-2011, 01:01 PM
  2. Show/Hide Textfields in Struts 2 form
    By aruna.hcu in forum Web Frameworks
    Replies: 3
    Last Post: 07-08-2010, 04:36 PM
  3. How can i hide the menu bar ?
    By Microman in forum CLDC and MIDP
    Replies: 0
    Last Post: 01-18-2010, 01:43 AM
  4. Show/Hide Label with JToggleButton
    By ntagrafix in forum AWT / Swing
    Replies: 4
    Last Post: 11-04-2009, 03:19 AM
  5. Resize shell on show/hide controls.
    By spacetoha in forum SWT / JFace
    Replies: 1
    Last Post: 03-24-2009, 01:20 PM

Tags for this Thread

Posting Permissions

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