// 初始化缓动插件 aos.init({ offset: 200, duration: 600, easing: 'ease', delay: 100, }); //设置首页视频背景铺满浏览器窗口 $(document).ready(function() { // 当浏览器载入时改变元素高度 $('#bg-video-box').css('height', $(window).height());//video高度始终与浏览器窗口一致 }); //当浏览器窗口改变大小时改变元素高度 (function(){ var timer = 0; //函数节流变量 $(window).resize(function(){ //窗口变化时执行 cleartimeout(timer);//去除函数节流计时器 timer = settimeout(function() {//函数节流计时器 $('#bg-video-box').css('height', $(window).height());//video高度始终与浏览器窗口一致 }, 200); }); }()); // 首页视频背景鼠标icon $('.bg-video-icon').mouseover(function(){ $('.bg-video-icon').addclass('active') }); $('.bg-video-icon').mouseout(function(){ $('.bg-video-icon').removeclass('active') }) //video锚链接缓动效果 $(function() { $(".position-icon").click(function() { var hr = $(this).attr("data-href"); var anh = ($(hr).offset().top) - $('.header-main').height(); $("html,body").stop().animate({ scrolltop: anh }, { easing: 'easeinoutquart', duration: 1500 }); }); }); //wap导航汉堡按钮动画切换 $(document).ready(function() { $(".hamburger").click(function() { //汉堡按钮折叠和交叉状态 $(this).toggleclass("is-active"); $('.wap-burger_menu').toggleclass('active'); //判断汉堡按钮的状态来收缩菜单栏 if ($(this).hasclass('is-active')) { $('body').css({ "overflow-x":"hidden", "overflow-y":"hidden" }); $('.wap-nav .search-box').fadeout(800); } else { $('body').css({ "overflow-x":"auto", "overflow-y":"auto" }); $('.wap-nav .search-box').fadein(800); } }); }); //wap端主导航伸缩和内页侧伸缩 $('.wap-burger_menu .level1>li>a').click(function() { $(this).parent().toggleclass('active').siblings().removeclass('active'); $(this).next().stop().slidetoggle("slow") .parent().siblings().children('a').removeclass('active') .next().slideup(); }); //pc端主导航二级下拉效果 $('.pc-header .level1>li').hover(function() { $(this).children('a').addclass('active'); $(this).children('.level2').css('display', 'block').stop().animate({ top: "100%", opacity: "1", }, { easing: 'easeoutcubic', duration: 500, queue: false, }); }, function() { $(this).children('a').removeclass('active'); $(this).children('.level2').stop().animate({ top: "100%", opacity: "0", }, { easing: 'easeoutcubic', duration: 300, queue: false, complete: function() { $(this).css('display', 'none'); } }); }); //主导航滚动高度缩小效果 $(window).scroll(function() { var sct = $(document).scrolltop(); if(sct >= 100){ $('.js-pc-header').addclass('scroll') }else{ $('.js-pc-header').removeclass('scroll') } }) //首页pc端banner图 var index_swiper = new swiper('.index_swiper', { loop: true, autoplay: { delay: 7000, stoponlastslide: false, disableoninteraction: false, }, speed: 1000, effect : 'fade', pagination: { el: '.swiper-pagination', clickable :true }, }); //加盟轮换图api var pcbannerswiper = new swiper('.pc-banner-swiper', { loop: true, speed: 600, autoplay: { delay: 3000, stoponlastslide: false, disableoninteraction: true, }, pagination: { el: '.swiper-pagination', clickable :true, }, }); //手机端banner图api var wapbannerswiper = new swiper('.wap-banner-swiper', { loop: true, speed: 600, autoplay: { delay: 3000, stoponlastslide: false, disableoninteraction: true, }, pagination: { el: '.swiper-pagination', }, }); //首页解决方案api var thumbsswiper = new swiper('.thumbs',{ spacebetween: 0, slidesperview: 3, spacebetween : 135, breakpoints: { //当宽度小于等于320 575: { spacebetween: 30 }, 767: { spacebetween: 45 }, 991: { spacebetween: 60 }, 1199: { spacebetween: 75 }, 1280: { spacebetween: 90 }, 1440: { spacebetween: 105 }, 1680: { spacebetween: 120 } }, watchslidesvisibility: true,//防止不可点击 allowslidenext : false, allowslideprev : false, }) var galleryswiper = new swiper('.gallery',{ speed:700, autoplay : { delay:3000 }, spacebetween: 10, thumbs: { swiper: thumbsswiper, slidethumbactiveclass: 'thumb-active', }, noswiping : true, noswipingclass : 'stop-swiping', effect : 'fade', fadeeffect: { crossfade: true, } }); //内页导航wap端展开 $('.module-021 .nav-top .right').click(function(){ $(this).parent().next().stop().slidetoggle('slow'); $(this).toggleclass('active'); if($(this).hasclass('active')){ $(this).html('关闭'); }else{ $(this).html('展开'); } }); //新闻列表图片切换 $('.module-040 .right .box').mouseover(function(){ var _this = $(this); var index = _this.index(); _this.addclass('active').siblings().removeclass('active'); $('.module-040 .left').find('.box').each(function(e){ if(e === index){ $(this).addclass('active').siblings().removeclass('active') } }) }) //加盟教练帮扶切换 $('.module-054>ul>li').mouseover(function(){ var _this = $(this); var index = _this.index(); _this.addclass('active').siblings().removeclass('active'); $('.module-055').find('.box').each(function(e){ if(e === index){ $(this).addclass('active').siblings().removeclass('active'); } }) }) //点击询盘按钮弹出表单 $('.js-open-xp').click(function(){ $('.js-xp').addclass('open') }) //点击关闭按钮关闭表单 $('.js-cloes-xp').click(function(){ $('.js-xp').removeclass('open') }) var gcswiper = new swiper(".gcswiper", { slidesperview: 3, spacebetween: 30, pagination: { el: ".swiper-pagination", clickable: true, }, breakpoints: { 575: { slidesperview: 2, spacebetween: 15, }, 767: { slidesperview: 2, spacebetween: 20, }, 991: { slidesperview: 3, spacebetween: 25, } }, }); $(function () { //提交表单 $("#schemebtnsubmit").bind("click", function () { $.ajax({ type: "post", url: $("#scheme_form").attr("url"), datatype: "json", data: $("#scheme_form").serialize(), timeout: 20000, beforesend: function (xmlhttprequest) { $("#schemebtnsubmit").attr("disabled", true); layer.msg('提交中...'); }, success: function (data, textstatus) { $("#schemebtnsubmit").attr("disabled", false); if (data.status == 1) { layer.msg(data.msg,{ icon: 1, time: 2000 }, function(){ window.location.reload(); }); } else { layer.msg(data.msg); console.log(data); } }, error: function (xmlhttprequest, textstatus, errorthrown) { layer.msg("state:" + textstatus + ";采暖方案需求提交失败:" + errorthrown); $("#schemebtnsubmit").attr("disabled", false); } }); return false; }); }); //打开自助选型弹窗 $('#js-zzxx-btn').click(function() { $('.module-082-bg').css('display', 'block').stop().animate({ opacity: "1", }, { easing: 'easeoutcubic', duration: 500, queue: false, }); }); //关闭自助选型弹窗 $('#js-cloes-module-082').click(function() { $('.module-082-bg').stop().animate({ opacity: "0", }, { easing: 'easeoutcubic', duration: 300, queue: false, complete: function() { $('.module-082-bg').css('display', 'none'); } }); }); //底部二维码弹窗 $(function() { // 打开二维码窗口 $(".ewm").click(function() { var thisewm = $(this).attr('data-ewm'); $('#'+thisewm).css('display','block'); $("#ewmbox").css('display', 'block'); $("#ewmbox").stop().animate({ left:"0", }, { easing: 'easeinoutquart', duration: 1000, queue: false, }); }); // 关闭二维码窗口 $("#closeewm").click(function() { $("#ewmbox").stop().animate({ left:"100%", }, { easing: 'easeinoutquart', duration: 1000, queue: false, complete: function() { $(this).find('.ewm-box').css('display','none'); $(this).css('display', 'none'); } }); }); }); //右侧在线客服 $(function() { var winw = $(window).width(); var winh = $(window).height(); $(window).scroll(function(){ // 右侧返回顶部 scrollt = $(window).scrolltop(); if (scrollt > winh/2) { $('.fix-bar-all').addclass('on'); } else { $('.fix-bar-all').removeclass('on'); } }); // 返回顶部 $('.fix-bar-top').click(function(event) { $('body, html').animate({scrolltop:0}, 600); return false; }); });