Team:TU Delft/menu2
From 2010.igem.org
(Difference between revisions)
Line 112: | Line 112: | ||
<li><a class="menu_button menu_button_blog" href="https://2010.igem.org/Team:TU_Delft/blog" title="Blog"> </a></li> | <li><a class="menu_button menu_button_blog" href="https://2010.igem.org/Team:TU_Delft/blog" title="Blog"> </a></li> | ||
<li><a class="menu_button menu_button_project" href="https://2010.igem.org/Team:TU_Delft/project" title="Project"> </a> | <li><a class="menu_button menu_button_project" href="https://2010.igem.org/Team:TU_Delft/project" title="Project"> </a> | ||
- | <ul | + | <ul> |
<li><a href="#">Project Description</a></li> | <li><a href="#">Project Description</a></li> | ||
</ul> | </ul> | ||
Line 126: | Line 126: | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
- | + | var timeout = 500; | |
+ | var closetimer = 0; | ||
+ | var ddmenuitem = 0; | ||
- | $( | + | function jsddm_open() |
+ | { jsddm_canceltimer(); | ||
+ | jsddm_close(); | ||
+ | ddmenuitem = $(this).find('ul').css('visibility', 'visible');} | ||
- | + | function jsddm_close() | |
+ | { if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');} | ||
- | + | function jsddm_timer() | |
+ | { closetimer = window.setTimeout(jsddm_close, timeout);} | ||
- | + | function jsddm_canceltimer() | |
- | $ | + | { if(closetimer) |
- | }); | + | { window.clearTimeout(closetimer); |
- | + | closetimer = null;}} | |
+ | |||
+ | $(document).ready(function() | ||
+ | { $('#navlist > li').bind('mouseover', jsddm_open) | ||
+ | $('#navlist > li').bind('mouseout', jsddm_timer)}); | ||
+ | |||
+ | document.onclick = jsddm_close; | ||
</script> | </script> | ||
</html> | </html> |
Revision as of 15:55, 17 June 2010