Team:NYMU-Taipei/menu.js
From 2014.igem.org
(Difference between revisions)
m |
m |
||
Line 32: | Line 32: | ||
}); | }); | ||
$('a').click(function(e){ | $('a').click(function(e){ | ||
+ | e.preventDefault(); | ||
var to=$(this).attr('href'); | var to=$(this).attr('href'); | ||
$.get(to,function(data){ | $.get(to,function(data){ | ||
console.log(data); | console.log(data); | ||
}); | }); | ||
- | + | return false; | |
}); | }); | ||
}); | }); |
Revision as of 12:56, 7 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('a > span').stop(true,true).animate({opacity: '1'}, 300); }) .on('mouseout', function(){ $.data(this,'timer', setTimeout($.proxy(function() { $(this).find('ul').stop(true,true).slideUp(200); }, this), 100)); $(this).find('a > span').stop(true,true).animate({opacity: '0'}, 700); }) .click( function(){ $(this).find('a > span').stop(true,true).animate({opacity: '1'}, 300); $('#menu > ul > li').not(this).find('a > span').stop(true,true).animate({opacity: '0'}, 300); }); $(window).scroll(function (event){ var y = $(this).scrollTop(); if(y>240){ $('#menu').css({ marginTop:0, }); } else{ $('#menu').css({ marginTop:240-y, }); } }); $('a').click(function(e){ e.preventDefault(); var to=$(this).attr('href'); $.get(to,function(data){ console.log(data); }); return false; });
});