snkcgw/js/about.js

72 lines
2.8 KiB
JavaScript
Raw Normal View History

2022-02-14 09:17:34 +00:00
if(screen.width <= 980){
2022-02-25 14:04:19 +00:00
let navTop = $(".pull-item-all").offset().top-70;
2022-02-14 09:17:34 +00:00
let abstractTop = $(".abstract-bg").offset().top-129;
let speechTop = $(".speech-bg").offset().top-129;
let teamTop = $(".team-bg").offset().top-129;
let organizationTop = $(".organization-bg").offset().top-129;
let memorabiliaTop = $(".memorabilia-bg").offset().top-129;
$(window).bind("scroll",function(){
let topScroll=$(this).scrollTop();//当前窗口的滚动距离
if(topScroll > navTop){
2022-02-25 14:04:19 +00:00
$(".pull-item-all").addClass("pull-item-fixed")
2022-02-14 09:17:34 +00:00
}else{
2022-02-25 14:04:19 +00:00
$(".pull-item-all").removeClass("pull-item-fixed")
2022-02-14 09:17:34 +00:00
}
if(topScroll > abstractTop){
$(".pull-item li").removeClass("cur");
$(".abstract-btn").addClass("cur");
}
if(topScroll > abstractTop & topScroll > speechTop){
$(".pull-item li").removeClass("cur");
$(".speech-btn").addClass("cur");
}
if(topScroll > abstractTop & topScroll > speechTop & topScroll > teamTop){
$(".pull-item li").removeClass("cur");
$(".team-btn").addClass("cur");
}
if(topScroll > abstractTop & topScroll > speechTop & topScroll > teamTop & topScroll > organizationTop){
$(".pull-item li").removeClass("cur");
$(".organization-btn").addClass("cur");
}
if(topScroll > abstractTop & topScroll > speechTop & topScroll > teamTop & topScroll > organizationTop & topScroll > memorabiliaTop){
$(".pull-item li").removeClass("cur");
$(".memorabilia-btn").addClass("cur");
}
});
}else{
2022-02-25 14:04:19 +00:00
let navTop = $(".pull-item-all").offset().top-90;
2022-02-14 09:17:34 +00:00
let abstractTop = $(".abstract-bg").offset().top-149;
let speechTop = $(".speech-bg").offset().top-149;
let teamTop = $(".team-bg").offset().top-149;
let organizationTop = $(".organization-bg").offset().top-149;
let memorabiliaTop = $(".memorabilia-bg").offset().top-149;
$(window).bind("scroll",function(){
let topScroll=$(this).scrollTop();//当前窗口的滚动距离
if(topScroll > navTop){
2022-02-25 14:04:19 +00:00
$(".pull-item-all").addClass("pull-item-fixed")
2022-02-14 09:17:34 +00:00
}else{
2022-02-25 14:04:19 +00:00
$(".pull-item-all").removeClass("pull-item-fixed")
2022-02-14 09:17:34 +00:00
}
if(topScroll > abstractTop){
$(".pull-item li").removeClass("cur");
$(".abstract-btn").addClass("cur");
}
if(topScroll > abstractTop & topScroll > speechTop){
$(".pull-item li").removeClass("cur");
$(".speech-btn").addClass("cur");
}
if(topScroll > abstractTop & topScroll > speechTop & topScroll > teamTop){
$(".pull-item li").removeClass("cur");
$(".team-btn").addClass("cur");
}
if(topScroll > abstractTop & topScroll > speechTop & topScroll > teamTop & topScroll > organizationTop){
$(".pull-item li").removeClass("cur");
$(".organization-btn").addClass("cur");
}
if(topScroll > abstractTop & topScroll > speechTop & topScroll > teamTop & topScroll > organizationTop & topScroll > memorabiliaTop){
$(".pull-item li").removeClass("cur");
$(".memorabilia-btn").addClass("cur");
}
});
};