Click here to Skip to main content
15,881,744 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I made a main page for my site. I wanna hide menus with display none and i try to add inline to my hover. But i can't made it. What should i do ?
Posted
Comments
Wombaticus 3-Jun-14 7:39am    
Try Googling for "CSS dropdown menu" and you will find lots of tutorials and code examples
What have you tried and where is the issue?

1 solution

Learn and adapt:
XML
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  var $menuitem = $("#menuitem");
  $menuitem.hide();
  $("#menuheader").hover(function(){
     $menuitem.show();
     },function(){
      $menuitem.hide();
  });
});
</script>
</head>
<body>

<p id="menuheader">Menu (Hover to see the item list)</p>
<ul id="menuitem">
<li>Home</li>
<li>FAQ</li>
<li>Contact</li>
</ul>

</body>
</html>
 
Share this answer
 
Comments
Wombaticus 3-Jun-14 8:21am    
Can I suggest you do NOT use this solution unless there are compelling reasons to do so? It has a lot more overhead than is necvessary for a simple drop-down menu, and a pure CSS solution (i.e. no Javascript) is always preferable where possible. Finally, you will not learn very much, other than manipulating some jQuery.

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