Team:NYMU-Taipei/menu.js

From 2014.igem.org

(Difference between revisions)
m
m
Line 4: Line 4:
             clearTimeout($.data(this,'timer'));
             clearTimeout($.data(this,'timer'));
             $(this).find('ul').stop(true,true).slideDown(200);   
             $(this).find('ul').stop(true,true).slideDown(200);   
-
             $(this).find('ul').fadeIn(200);
+
             $(this).find('span').fadeIn(200);
-
          // $(this).find('ul').css({display:'inline-block'});
+
     
         })
         })
         .on('mouseout', function(){
         .on('mouseout', function(){
Line 11: Line 11:
             $(this).find('ul').stop(true,true).slideUp(200);
             $(this).find('ul').stop(true,true).slideUp(200);
             }, this), 100));   
             }, this), 100));   
-
             $(this).find('ul').fadeIn(400);
+
             $(this).find('span').fadeIn(400);
-
        //  $(this).find('ul').css({display:'none'});
+
     
         });
         });
   $(window).scroll(function (event){
   $(window).scroll(function (event){

Revision as of 17:06, 5 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('span').fadeIn(200);
      
       })
       .on('mouseout', function(){
           $.data(this,'timer', setTimeout($.proxy(function() {
           $(this).find('ul').stop(true,true).slideUp(200);
           }, this), 100));  
           $(this).find('span').fadeIn(400);
     
       });
 $(window).scroll(function (event){
        var y = $(this).scrollTop();
        if(y>240){
            $('#menu').css({
                marginTop:0,
            });
        }
        else{
            $('#menu').css({
               marginTop:240-y,  
            });
        }
 });

});