Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
when click menu its pop up when click again nothing happen!
JavaScript
function mainmenu() {
    $(" #nav ul").css({ display: "none" });
    $(" #nav li").hover(function () {
        $(this).find('ul:first').css({ visibililty: "visible", display: "none" }).show(100);
    }
    , function () {
        $(this).find('ul:first').css({ visibility: "hidden" });
    });
}
$(document).ready(function () {
    mainmenu();
});


What I have tried:

im try to use another thing but i cant
Posted
Updated 7-Jan-17 2:28am
v2
Comments
SrikantSahu 6-Jan-17 15:33pm    
You can try
$(" #nav li").hover(function () {
$(this).find('ul:first').show();
}
, function () {
$(this).find('ul:first').hide();
});

This should show the embedded ui element inside the '#nav li' when hovered and hide the ui when mouse out of the '#nav li'.

1 solution

What are you trying to achieve? Your code does not make any sense at all. You have to seriously learn the stuff, trying by luck is not going to bring you anywhere. Learn some real stuff at jQuery Tutorial[^] .
Coming back to your make-no-sense code and not-at-all-clear question, if you are trying to show/hide a menu list, you can do a toggle, a sample code below:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
    $("#nav ul").css("display", "none");
    $("#nav").hover(function(){
    	$("ul").toggle(500);
    });
});
</script>
</head>
<body>
<div id="nav">MENU
	<ul>
		<li>HTML</li>
		<li>CSS</li>
		<li>JavaScript</li>
		<li>jQuery</li>
	</ul>
</div>
</body>
</html>
or try out this demo at JSFiddle[^]. Read up on some jQuery tutorial so that you can understand the code. Luck is elusive, only learning is real.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900