Difference between revisions of "Team:ZJU-China/Template/label.js"
(Created page with "$(document).ready(function(){ var isHiden1 = true; /*控制切换菜单*/ var isHiden2 = true; →控制切换菜单: $('#popView1').click(function(){ if(isHi...") |
|||
Line 1: | Line 1: | ||
− | + | jQuery(document).ready(function(){ | |
var isHiden1 = true; /*控制切换菜单*/ | var isHiden1 = true; /*控制切换菜单*/ | ||
var isHiden2 = true; /*控制切换菜单*/ | var isHiden2 = true; /*控制切换菜单*/ | ||
− | + | jQuery('#popView1').click(function(){ | |
if(isHiden1){ | if(isHiden1){ | ||
− | + | jQuery('#popView1').animate({left:'+=150px'});//菜单块向右移动 | |
− | + | jQuery('#popView2').css('display','inline'); | |
− | + | jQuery('#popView2').animate({right:'+=150px'});//菜单块向右移动 | |
}else{ | }else{ | ||
− | + | jQuery('#popView1').animate({left:'-=150px'}); //菜单块向左移动 | |
− | + | jQuery('#popView2').animate({right:'-=150px'});//菜单块向右移动 | |
− | + | jQuery('#popView2').css('display','none'); | |
} | } | ||
isHiden1 = !isHiden1; | isHiden1 = !isHiden1; | ||
Line 35: | Line 35: | ||
}); | }); | ||
/* slide */ | /* slide */ | ||
− | + | jQuery(document).ready(function(){ | |
− | + | jQuery('a[href^="#"]').on('click',function (e) { | |
e.preventDefault(); | e.preventDefault(); | ||
var target = this.hash, | var target = this.hash, | ||
− | $target = | + | $target = jQuery(target); |
− | + | jQuery('html, body').stop().animate({ | |
'scrollTop': $target.offset().top | 'scrollTop': $target.offset().top | ||
}, 900, 'swing', function () { | }, 900, 'swing', function () { |
Revision as of 04:58, 5 September 2015
jQuery(document).ready(function(){
var isHiden1 = true; /*控制切换菜单*/ var isHiden2 = true; /*控制切换菜单*/ jQuery('#popView1').click(function(){ if(isHiden1){ jQuery('#popView1').animate({left:'+=150px'});//菜单块向右移动
jQuery('#popView2').css('display','inline'); jQuery('#popView2').animate({right:'+=150px'});//菜单块向右移动
}else{ jQuery('#popView1').animate({left:'-=150px'}); //菜单块向左移动 jQuery('#popView2').animate({right:'-=150px'});//菜单块向右移动
jQuery('#popView2').css('display','none');
} isHiden1 = !isHiden1; });
});
jQuery(function() {
jQuery(document).scroll(function() {
if(jQuery(document).scrollTop()>=100) { jQuery('aside').css('position','fixed').css('top','50px'); jQuery('asider').css('position','fixed').css('top','50px'); } else { jQuery('aside').css('position','static').css('float','left').css('position','absolute').css('top','150px'); jQuery('asider').css('position','static').css('float','left').css('position','absolute').css('top','150px'); } });
}); /* slide */ jQuery(document).ready(function(){
jQuery('a[href^="#"]').on('click',function (e) { e.preventDefault();
var target = this.hash, $target = jQuery(target);
jQuery('html, body').stop().animate({ 'scrollTop': $target.offset().top }, 900, 'swing', function () { window.location.hash = target; }); });
});