pzct/public/static/web/js/style.js

134 lines
3.6 KiB
JavaScript
Raw Normal View History

2023-08-02 15:23:38 +08:00
// WOw插件初始化
var wow = new WOW({
boxClass: 'wow',
animateClass: 'animated',
offset: 80,
mobile: true,
live: true,
});
wow.init();
$(function(){
2023-08-02 16:48:45 +08:00
let url = window.location.href;
let lastChar = url.slice(-1);
let result = url.includes("about");
console.log(lastChar,result); // 输出:最后一个字符
if(result && lastChar == 'l') {
$(".info a").eq(0).addClass("on").siblings().removeClass("on");
$(".inner-navInfo a").eq(0).addClass("curr").siblings().removeClass("curr");
}
$(".info a").eq(lastChar-1).addClass("on").siblings().removeClass("on");
$(".inner-navInfo a").eq(lastChar-1).addClass("curr").siblings().removeClass("curr");
var heightChu = $(".header").height() + 10;
var hashUrl = window.location.hash;
console.log(hashUrl)
if(hashUrl) {
$("html, body").animate({
scrollTop: $(hashUrl).offset().top - heightChu + "px"
}, 1000);
}
// 走进产投点击
2023-08-02 15:31:15 +08:00
$(".listcur.info a").click(function(){
2023-08-02 15:23:38 +08:00
$(this).addClass("on").siblings().removeClass("on");
2023-08-02 15:31:15 +08:00
var index = $(this).index();
2023-08-02 16:48:45 +08:00
$(".inner-navInfo a").eq(index).addClass("curr").siblings().removeClass("curr");
$(".menu").removeClass("is-active");
$(".right-boxs").find(".nav").removeClass('inshow');
$(".right-boxs").find(".form").removeClass('form-show');
var height = $(".header").height() + 10;
var hash = $(this).attr("href").substring(11);
console.log(hash)
$("html, body").animate({
scrollTop: $(hash).offset().top - height + "px"
}, 1000);
return false;
2023-08-02 15:23:38 +08:00
})
$(".hamburger").click(function(){
$(this).toggleClass("is-active");
$(this).siblings(".right-boxs").find(".nav").toggleClass('inshow');
$(this).siblings(".right-boxs").find(".form").toggleClass('form-show');
});
$(window).scroll(function() {
if($(window).scrollTop() > 200) {
$('.header').addClass("fixed-header");
} else {
$('.header').removeClass("fixed-header");
}
})
$(".header .nav .nLi h3").mouseenter(function(event) {
$(this).siblings('.listcur').show();
});
$(".header .nav .nLi").mouseleave(function(event) {
$(this).find(".listcur").hide();
});
// banner
var swiper1 = new Swiper('.banner .swiper-container', {
speed:1000,
loop:true,
autoplay: {
delay: 5000,
stopOnLastSlide: false,
disableOnInteraction: true,
},
navigation: {
nextEl: '.button-next',
prevEl: '.button-prev',
},
pagination: {
el: '.swiper-pagination',
clickable: true,
},
});
//当banner图片大于1张时候运行
var bannerbox = $(".banner").find(".swiper-slide").length;
if(bannerbox == 1){
$(".banner").find('.swiper-container').addClass("swiper-no-swiping");
$(".banner").find(".swiper-pagination").hide();
$(".banner").find(".btn-next").hide();
$(".banner").find(".btn-prev").hide();
}
jQuery(".index-locate").slide({
titCell:".hd li",
mainCell: ".bd",
});
jQuery(".business-content .list").slide({
titCell:".hd li",
mainCell: ".bd",
effect:"fold"
});
// 右侧悬浮栏
$(window).scroll(function() {
if($(window).scrollTop() > 400) {
$('.back').fadeIn();
$(".header").addClass("fixed-header")
} else {
$('.back').fadeOut();
$(".header").removeClass("fixed-header")
}
})
$(".back").click(function(){
$('body,html').animate({scrollTop:0},1000);
return false;
});
$("body").on('click','.talent-top',function(){
$(this).siblings(".talent-bottom").slideToggle();
$(this).parents(".boxs").siblings().find(".talent-bottom").slideUp();
})
})