snkcgw/js/about.js

72 lines
2.8 KiB
JavaScript

if(screen.width <= 980){
let navTop = $(".pull-item-all").offset().top-70;
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){
$(".pull-item-all").addClass("pull-item-fixed")
}else{
$(".pull-item-all").removeClass("pull-item-fixed")
}
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{
let navTop = $(".pull-item-all").offset().top-90;
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){
$(".pull-item-all").addClass("pull-item-fixed")
}else{
$(".pull-item-all").removeClass("pull-item-fixed")
}
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");
}
});
};