// WOW动画 if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))) { new WOW().init(); }; $(document).ready(function(){ $(".sz-kefu .kf1").click(function(){ $('.sz-kefu .qq').find(".sidebox").stop().animate({"right":"0"},160); $(this).find(".sidebox").stop().animate({"right":"-50px"},160); }); $(".sz-kefu .qq .close").click(function(){ $('.sz-kefu .qq').find(".sidebox").stop().animate({"right":"-150px"},160); $('.sz-kefu .kf1').find(".sidebox").stop().animate({"right":"0"},160); }); $(".sz-kefu .kf3").hover(function(){ $(this).find(".sidebox").stop().animate({"width":"130px"},160); $(this).find(".sidebox3").stop().animate({"width":"200px"},160); },function(){ $(this).find(".sidebox").stop().animate({"width":"50px"},160); }); $('.sz-kefu .kf2').hover(function() { $(this).find('.kf_wx').fadeIn(); }, function() { $(this).find('.kf_wx').fadeOut(); }); }); function goTop(){ $('html,body').animate({'scrollTop':0},600); } // 轮播 // var main = { // winW: null, // winH: null, // browser: null, // init: function() { // main.winH = $(window).height(); // $('.banner').css('height', main.winH - 100 + 'px'); // main.browser = navigator.userAgent; // $(window).resize(function() { // main.resize(); // }); // main.resize(); // }, // resize: function() { // main.winW = ($(window).width() <= 1280) ? 1280 : $(window).width(); // main.winH = $(window).height(); // $('.banner').css('height', main.winH - 100 + 'px'); // }, // } // main.init() // $(function(){ // if($('body').hasClass('main')) main.init(); // }); // // var Swiper1 = new Swiper('.banner-container', { pagination: { el: '.banner-pg', clickable: true, }, navigation: { nextEl: '.banner-next', prevEl: '.banner-prev', }, autoplay: false, autoplay: { delay: 7000, }, loop: true, speed: 800 }); // 导航 $("#menuph").click(function () { $(this).find(".point").toggleClass("active"); $(".xialaph").slideToggle(); $(".phonemeng").toggleClass('active'); // $("body,html").animate({ // scrollTop: 0 // }, 500); }); $(".xialaph h4").click(function () { $(this).siblings(".ul2").slideToggle(); $(this).parent().siblings().find(".ul2,.ul3").slideUp(); $(this).toggleClass("active"); $(this).parent().siblings().find("h4,h5").removeClass('active'); }); $(".xialaph h5").click(function () { $(this).siblings(".ul3").slideToggle(); $(this).parent().siblings().find(".ul3").slideUp(); $(this).toggleClass("active"); $(this).parent().siblings().find("h4,h5").removeClass('active'); }); $(".xialaph .lian h5").click(function () { $(this).siblings().toggleClass('active'); }); $(".sfq-list li").hover(function() { $(this).addClass("on").siblings().removeClass("on"); }) // 首页新闻 var newsSwiper = new Swiper('.index-news-content', { speed: 500, spaceBetween: 30, on: { slideChangeTransitionStart: function() { $(".index-news-tab .on").removeClass('on'); $(".index-news-tab li").eq(this.activeIndex).addClass('on'); } } }) $(".index-news-tab li").on('click', function(e) { e.preventDefault() $(".index-news-tab .on").removeClass('on') $(this).addClass('on') newsSwiper.slideTo($(this).index()) }) // 环境 var hj01Swiper = new Swiper('.huanjing-list-1 .swiper-container', { autoplay: { delay: 3000, }, slidesPerView: 3, // spaceBetween: 20, slidesPerGroup: 1, loop: true, pagination: { el: '.pg1', clickable: true, }, navigation: { nextEl: '.next-hj-1', prevEl: '.prev-hj-1', }, breakpoints: { 640: { slidesPerView: 2, slidesPerGroup: 2, }, 768: { slidesPerView: 2, slidesPerGroup: 2, }, 1000: { slidesPerView: 2, slidesPerGroup: 2, }, } }) var hj02Swiper = new Swiper('.huanjing-list-2 .swiper-container', { autoplay: { delay: 3000, }, slidesPerView: 3, // spaceBetween: 20, slidesPerGroup: 1, loop: true, pagination: { el: '.pg2', clickable: true, }, navigation: { nextEl: '.next-hj-2', prevEl: '.prev-hj-2', }, breakpoints: { 640: { slidesPerView: 2, slidesPerGroup: 2, }, 768: { slidesPerView: 2, slidesPerGroup: 2, }, 1000: { slidesPerView: 2, slidesPerGroup: 2, }, } }) var hj03Swiper = new Swiper('.huanjing-list-3 .swiper-container', { autoplay: { delay: 3000, }, slidesPerView: 3, // spaceBetween: 20, slidesPerGroup: 1, loop: true, pagination: { el: '.pg3', clickable: true, }, navigation: { nextEl: '.next-hj-3', prevEl: '.prev-hj-3', }, breakpoints: { 640: { slidesPerView: 2, slidesPerGroup: 2, }, 768: { slidesPerView: 2, slidesPerGroup: 2, }, 1000: { slidesPerView: 2, slidesPerGroup: 2, }, } }) // 产品分类 $('.product-cate-list h4').click(function() { if ($(this).next('.product-subcate').css('display') == "none") { $('.product-subcate').slideUp(); $(this).next('.product-subcate').slideDown(); $('.product-cate-list h4').removeClass("on"); $(this).addClass("on"); } else { $('.product-subcate').slideUp(); $('.product-cate-list h4').removeClass("on"); } }) // 产品详情图 var productAlbum = new Swiper('.product-album', { autoplay: false, loop: true, pagination: { el: '.pg-album', clickable: true, } }) // 产品详情tab // var productSwiper = new Swiper('.product-tabcont', { // speed: 500, // spaceBetween: 52, // on: { // slideChangeTransitionStart: function() { // $(".product-tab .on").removeClass('on'); // $(".product-tab li").eq(this.activeIndex).addClass('on'); // } // } // }) // $(".product-tab li").on('click', function(e) { // e.preventDefault() // $(".product-tab .on").removeClass('on') // $(this).addClass('on') // productSwiper.slideTo($(this).index()) // }) /** * JavaScript脚本实现回到页面顶部示例 * @param acceleration 速度 * @param stime 时间间隔 (毫秒) **/ function gotoTop(acceleration,stime) { acceleration = acceleration || 0.1; stime = stime || 10; var x1 = 0; var y1 = 0; var x2 = 0; var y2 = 0; var x3 = 0; var y3 = 0; if (document.documentElement) { x1 = document.documentElement.scrollLeft || 0; y1 = document.documentElement.scrollTop || 0; } if (document.body) { x2 = document.body.scrollLeft || 0; y2 = document.body.scrollTop || 0; } var x3 = window.scrollX || 0; var y3 = window.scrollY || 0; // 滚动条到页面顶部的水平距离 var x = Math.max(x1, Math.max(x2, x3)); // 滚动条到页面顶部的垂直距离 var y = Math.max(y1, Math.max(y2, y3)); // 滚动距离 = 目前距离 / 速度, 因为距离原来越小, 速度是大于 1 的数, 所以滚动距离会越来越小 var speeding = 1 + acceleration; window.scrollTo(Math.floor(x / speeding), Math.floor(y / speeding)); // 如果距离不为零, 继续调用函数 if(x > 0 || y > 0) { var run = "gotoTop(" + acceleration + ", " + stime + ")"; window.setTimeout(run, stime); } }