Difference between revisions of "Template:Hebrewu/Javascript"

Line 31: Line 31:
 
     document.onclick = ddmenu_close;
 
     document.onclick = ddmenu_close;
 
</script>
 
</script>
 
<!--- Main Menu script end --->
 

Revision as of 07:59, 7 September 2018

<script>

   var timeout    = 500;
   var closetimer = 0;
   var ddmenuitem = 0;
        
   function ddmenu_open(){
       ddmenu_canceltimer();
          ddmenu_close();
          ddmenuitem = $(this).find('ul').css('visibility', 'visible');
   }
        
   function ddmenu_close(){ 
       if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');
   }
        
   function ddmenu_timer(){
       closetimer = window.setTimeout(ddmenu_close, timeout);
   }
        
   function ddmenu_canceltimer(){  
       if(closetimer){  
           window.clearTimeout(closetimer);
               closetimer = null;
   }}
        
   $(document).ready(function(){  
       $('#ddmenu_hebrewu > li').bind('mouseover', ddmenu_open)
       $('#ddmenu_hebrewu > li').bind('mouseout',  ddmenu_timer)
   });
        
   document.onclick = ddmenu_close;

</script>