You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.2 KiB
35 lines
1.2 KiB
$(function (){
|
|
// 改变导航栏颜色
|
|
$(window).scroll(function () {
|
|
// let top = $(document).scrollTop(); // 获取当前滚动的数值
|
|
// if (top > 1) { // 大于1就改变颜色
|
|
// $('.header').addClass("active");
|
|
// $('.header .w1400 .logo img').attr('src',"")
|
|
// return
|
|
// }
|
|
// $('.header').removeClass("active");
|
|
// $('.header .w1400 .logo img').attr('src',"")
|
|
});
|
|
|
|
// 锚点定位
|
|
$('.nav li').on('click', function () {
|
|
let i = $(this).index();
|
|
if (i == 0) {
|
|
$('body,html').stop().animate({scrollTop:0})
|
|
$('.header').removeClass('active')
|
|
} else {
|
|
$('body,html').stop().animate({scrollTop:$('.blockBox:eq(' + (i - 1) +')').offset().top - 77})
|
|
$('.header').addClass('active')
|
|
}
|
|
})
|
|
|
|
// 移动端导航
|
|
$('.header .w1400 .right .menu').click(function(){
|
|
$('.blackBg').stop().fadeIn()
|
|
$('.blackBg .nav').stop().animate({right:'0'})
|
|
})
|
|
$('.nav li').click(function(){
|
|
$('.blackBg .nav').stop().animate({right:'-80%'})
|
|
$('.blackBg').stop().fadeOut()
|
|
})
|
|
})
|