Team:NYMU-Taipei/menu.js

From 2014.igem.org

(Difference between revisions)
m
m
Line 16: Line 16:
         if(y>60){
         if(y>60){
             $('#menu').css({
             $('#menu').css({
-
               
+
                 
-
                 top:0,
+
                 margin-top:0,
             });
             });
         }
         }
Line 23: Line 23:
             $('#menu').css({
             $('#menu').css({
                 position:'relative',
                 position:'relative',
-
                 top:60,
+
                 margin-top:240,
             });
             });
         }
         }
   });
   });
});
});

Revision as of 15:25, 2 June 2014

$( document ).ready(function() {

 $('#menu > ul > li')
       .on('mouseover', function(){
           clearTimeout($.data(this,'timer'));
           $(this).find('ul').stop(true,true).slideDown(200);  
          // $(this).find('ul').css({display:'inline-block'});
       })
       .on('mouseout', function(){
           $.data(this,'timer', setTimeout($.proxy(function() {
           $(this).find('ul').stop(true,true).slideUp(200);
           }, this), 100));  
        //   $(this).find('ul').css({display:'none'});
       });
 $(window).scroll(function (event){
        var y = $(this).scrollTop();
        if(y>60){
            $('#menu').css({
                 
                margin-top:0,
            });
        }
        else{
            $('#menu').css({
                position:'relative',
                margin-top:240,
            });
        }
 });

});