I want to create a simple drop-down menu with a div, but I have this problem: when the div goes above my button, itβs very good, but when the mouse leaves the field of my link (in this case show / hide text) my div is hidden. How can I change the hidden area button? because in my files I cannot select the links in the dropdown div.
HTML code:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Papermashup.com | Sliding Div</title> <script src="jquery.js" type="text/javascript"></script> <script src="dropdown/drop.js" type="text/javascript"></script> <link type="text/css" href="dropdown/drop.css" rel="stylesheet"/> </head> <body> <a href="#" class="show_hide">Show/hide</a><br /> <div class="slidingDiv" style="width:103px;height:60px;"> <img alt="" height="80" src="images/dropdown.png" width="103"> </div> </body> </html>
CSS code:
.show_hide { display:none; }
JavaScript Code:
$(document).ready(function(){ $(".slidingDiv").hide(); $(".show_hide").show(); $('.show_hide').mouseover(function(){ $(".slidingDiv").slideToggle(); }); $('.show_hide').mouseout(function(){ $(".slidingDiv").slideToggle(); }); });
Mohamamdreza siahpoosh
source share