×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Srinivasan Pusuluri
Added: May 14, 2015 4:51 PM
Views: 8
Tags: no tags
jquery - css dropdown menu
  1. var timer;
  2.  
  3. $(".parent").on("mouseover", function() {
  4.   clearTimeout(timer);
  5.   openSubmenu();
  6. }).on("mouseleave", function() {
  7.   timer = setTimeout(
  8.     closeSubmenu
  9.   , 1000);
  10. });
  11.  
  12. function openSubmenu() {
  13.   $(".submenu").addClass("open");
  14. }
  15. function closeSubmenu() {
  16.   $(".submenu").removeClass("open");
  17. }