/* * JS基础处理框架 * -- 提倡互联网共享,同时应尊重原创作者,网站制作属: 爱企云 -- * * @company: iqweb * @author: jack * timer: 2021年 * Tel:18565633435 * QQ:897232289 * WeChat:18565633435 */ var IqwXiongJs = { Width: $(window).width(), Height: $(window).height(), //锚点距离 maoNumber: 0, //数字滚动判断 NumberIf: true, Number: [], //有锚点才吸顶 maoTop: false, WapNavIF: true, bannerAnimation: 'AddFadeInUp', //滚动条 MyScroll: null, //加载 ImagesLoad: false, SvgTimeOver: null, SvgTime: 0, ImgArray: [], allImages: [], FilterTime: null, FilterNumber: null, //增加 IndexPageTab: null, IndexBannerTab: null, IndexProTab: null, IndexNewsTab: null, AboutPageTab: null, AboutCompanyTab: null, ProPageTab: null, ContactTab: null, HeaderDownTab: null, IndexLastIf: false, AboutLastIf: false, //新增 //EventKey: "ontouchstart" in document.documentElement ? "touchstart" : "click", Init: function () { var that = this; that.HtmlInit(); }, //事件 AddEventList: function () { var that = this; // console.log($(".about_message_item_box:nth-child(1) svg path").get(0).getTotalLength()); function return_false() { return false; } $('#top').on('click', function (e) { e.preventDefault(); that.ReturnTop(); }); if ($('.solution_page_content').length > 0) { $(document.body).animate({ scrollTop: $('.news_page_banner_box').height() -$('.header_wrap').height() }, 700); $('html').animate({ scrollTop: $('.news_page_banner_box').height() -$('.header_wrap').height() }, 700) } $('.index_business_item_box').hover(function (e) { e.preventDefault(); $('.index_business_item_box').eq($(this).index()).addClass('index_business_item_active').siblings().removeClass('index_business_item_active'); }); $('.index_news_li').hover(function (e) { e.preventDefault(); $('.index_news_li').eq($(this).index()).addClass('index_news_active').siblings().removeClass('index_news_active'); }); $('.header_nav_item').hover(function (e) { e.preventDefault(); $('.header_nav_item').addClass('header_nav_default').eq($(this).index()).addClass('header_nav_hover'); }, function () { $('.header_nav_item').removeClass('header_nav_default header_nav_hover'); }); $('.about_culture_item_box').hover(function () { $('.about_culture_item_box').eq($(this).index()).addClass('about_culture_item_active').siblings().removeClass('about_culture_item_active'); }); $('.news_content_nav_item').hover(function (e) { e.preventDefault(); $('.news_content_nav_item').addClass('news_content_nav_default').eq($(this).index()).addClass('news_content_nav_hover'); }, function () { $('.news_content_nav_item').removeClass('news_content_nav_default news_content_nav_hover'); }); $('.pro_banner_item_box').on('click', function (e) { e.preventDefault(); $('.pro_banner_item_box').eq($(this).index()).addClass('pro_banner_item_active').siblings().removeClass('pro_banner_item_active'); that.ProPageTab.slideTo($(this).index()); $(document.body).animate({ scrollTop: $('.pro_page_wrap').offset().top - $('.header_wrap').height() - ($('.pro_banner_list').height()) }, 700); $('html').animate({ scrollTop: $('.pro_page_wrap').offset().top - $('.header_wrap').height() - ($('.pro_banner_list').height()) }, 700) }); $('.contact_wap_item_box').on('click', function (e) { e.preventDefault(); $('.contact_wap_item_box').eq($(this).index()).addClass('contact_wap_item_active').siblings().removeClass('contact_wap_item_active'); that.ContactTab.slideTo($(this).index()); }); $('.join_post_item_box').eq(0).addClass('join_post_item_active'); $('.join_post_item_box').eq(0).find('.join_post_item_content').css({ height: $('.join_post_item_box').eq(0).find('.join_post_item_animate').height() }) $('.join_post_item_head').on('click', function (e) { e.preventDefault(); if ($(this).parents('.join_post_item_box').hasClass('join_post_item_active')) { $(this).parents('.join_post_item_box').removeClass('join_post_item_active'); $(this).parents('.join_post_item_box').find('.join_post_item_content').css({ height: 0 }) } else { $(this).parents('.join_post_item_box').addClass('join_post_item_active'); $(this).parents('.join_post_item_box').find('.join_post_item_content').css({ height: $(this).parents('.join_post_item_box').find('.join_post_item_animate').height() }) } }); $('.header_down_nav_link').hover(function (e) { e.preventDefault(); $('.header_down_nav_link').removeClass('header_down_nav_current'); $(this).addClass('header_down_nav_current') }); $('.header_nav_item').hover(function (e) { e.preventDefault(); if ($('.header_nav_item').eq($(this).index()).find('.header_down_wrap').length > 0) { $('.header_wrap').addClass('header_hover_black'); } $('.header_nav_item').eq($(this).index()).find('.header_down_wrap').css({ height: $('.header_nav_item').eq($(this).index()).find('.header_down_animate').height() }) }, function () { $('.header_wrap').removeClass('header_hover_black'); $('.header_nav_item').eq($(this).index()).find('.header_down_wrap').css({ height: 0 }) }); }, //index IndexPageSwiper: function () { var that = this; var interleaveOffset = 0.5; //视差比值 var TouchMove = false; if (that.Width < 1200) { TouchMove = true; } that.IndexPageTab = new Swiper(".index_page_swiper", { initialSlide: 0, direction: 'vertical', slidesPerView: 'auto', //禁止滑动时swiper移动 followFinger: false, //禁止手指滑动 allowTouchMove: TouchMove, //鼠标 mousewheel: true, //键盘 keyboard: { enabled: true, }, //切换时间 speed: 1000, //切换时滑动无效直到切换结束 preventInteractionOnTransition: true, on: { transitionStart: function () { console.log(this.realIndex); if (this.realIndex == 0) { $('.header_wrap').removeClass('header_black header_white'); } if (this.realIndex == 1) { $('.header_wrap').removeClass('header_white').addClass('header_black'); } if (this.realIndex == 2) { $('.header_wrap').removeClass('header_white').addClass('header_black'); } if (this.realIndex == 3) { $('.header_wrap').removeClass('header_white').addClass('header_black'); } if (this.realIndex == 4) { if (that.Width > 1200) { if (that.IndexLastIf) { that.IndexLastIf = false; console.log('离开最后一页'); } else { $('.header_wrap').removeClass('header_white').addClass('header_black'); } } else { $('.header_wrap').removeClass('header_white').addClass('header_black'); } } if (this.realIndex == 5) { if (that.Width < 1200) { $('.header_wrap').removeClass('header_black header_white'); } } }, //最后一页 reachEnd: function () { that.IndexLastIf = true; console.log('进入最后一页'); $('.header_wrap').removeClass('header_black').addClass('header_white'); }, slideChangeTransitionEnd: function () { $('.index_page_slide').removeClass('index_page_current').eq(this.realIndex).addClass('index_page_current'); } } }); }, //About AboutPageSwiper: function () { var that = this; var interleaveOffset = 0.5; //视差比值 var TouchMove = false; if (that.Width < 1200) { TouchMove = true; } setTimeout(function () { that.AboutPageTab = new Swiper(".about_page_swiper", { initialSlide: 0, direction: 'vertical', slidesPerView: 'auto', //禁止滑动时swiper移动 followFinger: false, //禁止手指滑动 allowTouchMove: TouchMove, //鼠标 mousewheel: true, //键盘 keyboard: { enabled: true, }, //切换时间 speed: 1000, //切换时滑动无效直到切换结束 preventInteractionOnTransition: true, on: { init: function () { $('.header_wrap').addClass('header_black'); $('.about_page_slide').eq(0).addClass('about_page_current'); }, transitionStart: function () { console.log(this.realIndex); if (this.realIndex == 0) { $('.header_wrap').removeClass('header_white').addClass('header_black'); } if (this.realIndex == 1) { $('.header_wrap').removeClass('header_white').addClass('header_black'); } if (this.realIndex == 2) { $('.header_wrap').removeClass('header_white').addClass('header_black'); } if (this.realIndex == 3) { $('.header_wrap').removeClass('header_white').addClass('header_black'); } if (this.realIndex == 4) { $('.header_wrap').removeClass('header_white').addClass('header_black'); } if (this.realIndex == 5) { $('.header_wrap').removeClass('header_white').addClass('header_black'); } if (this.realIndex == 6) { $('.header_wrap').removeClass('header_white').addClass('header_black'); } if (this.realIndex == 7) { $('.header_wrap').removeClass('header_white').addClass('header_black'); } if (this.realIndex == 8) { if (that.Width > 1200) { if (that.AboutLastIf) { that.AboutLastIf = false; console.log('离开关于我们最后一页'); } else { $('.header_wrap').removeClass('header_white header_black'); } } else { $('.header_wrap').removeClass('header_white header_black'); } } if (this.realIndex == 9) { if (that.Width < 1200) { $('.header_wrap').removeClass('header_black header_white'); } } }, //最后一页 reachEnd: function () { that.AboutLastIf = true; console.log('进入关于我们最后一页'); $('.header_wrap').removeClass('header_black').addClass('header_white'); }, slideChangeTransitionEnd: function () { $('.about_page_slide').removeClass('about_page_current').eq(this.realIndex).addClass('about_page_current'); that.NumberIf = true; if (this.realIndex == 5) { that.AboutNumber(); } } } }); }, 300) }, //banner IndexBannerSwiper: function () { var that = this; setTimeout(function () { that.IndexBannerTab = new Swiper(".index_banner_swiper", { effect: 'fade', loop: true, speed: 800, grabCursor: true, pagination: { el: '.index_banner_pagination', clickable: true, }, autoplay: { delay: 6000, stopOnLastSlide: false, disableOnInteraction: false, }, }); }, 300); setTimeout(function () { $('.index_banner_pagination').addClass('index_banner_show'); }, 600) }, IndexProSwiper: function () { var that = this; var aSlidesPerView = 4; if (that.Width < 1200) { aSlidesPerView = 1.1; } var aSpaceBetween = that.Width * 0.01041666; that.IndexProTab = new Swiper(".index_pro_swiper", { loop: true, speed: 800, slidesPerView: aSlidesPerView, navigation: { nextEl: ".index_pro_next", prevEl: ".index_pro_prev", }, // spaceBetween: aSpaceBetween, }); }, IndexNewsSwiper: function () { var that = this; var aSlidesPerView = 3; var aSpaceBetween = that.Width * 0.0125; if (that.Width < 1200) { aSlidesPerView = 1.2; aSpaceBetween = that.Width * 0.02415458; } that.IndexNewsTab = new Swiper(".index_news_swiper", { loop: true, speed: 800, slidesPerView: aSlidesPerView, spaceBetween: aSpaceBetween, }); }, AboutCompanySwiper: function () { var that = this; var TouchMove = false; var aSlidesPerView = 2; var aSpaceBetween = that.Width * 0.0125; if (that.Width < 1200) { TouchMove = true; aSlidesPerView = 1.8; } that.AboutCompanyTab = new Swiper(".about_company_swiper", { loop: true, speed: 800, slidesPerView: aSlidesPerView, spaceBetween: aSpaceBetween, centeredSlides: true, //禁止滑动时swiper移动 followFinger: false, //禁止手指滑动 allowTouchMove: TouchMove, navigation: { nextEl: ".about_company_btn_next", prevEl: ".about_company_btn_prev", }, }); }, ProPageSwiper: function () { var that = this; var TouchMove = false; if (that.Width < 1200) { TouchMove = false; } that.ProPageTab = new Swiper(".pro_page_swiper", { initialSlide: 0, effect: "fade", speed: 800, autoHeight: true, //禁止滑动时swiper移动 followFinger: false, //禁止手指滑动 allowTouchMove: TouchMove, }); }, ContactSwiper: function () { var that = this; var TouchMove = false; if (that.Width < 1200) { TouchMove = false; } that.ContactTab = new Swiper(".contact_page_swiper", { effect: "fade", speed: 800, //禁止滑动时swiper移动 followFinger: false, //禁止手指滑动 allowTouchMove: TouchMove, }); }, HeaderDownSwiper: function () { var that = this; var TouchMove = false; if (that.Width < 1200) { TouchMove = false; } that.HeaderDownTab = new Swiper(".header_down_nav_swiper", { effect: "fade", speed: 800, //禁止滑动时swiper移动 followFinger: false, //禁止手指滑动 allowTouchMove: TouchMove, }); }, //导航js HeaderMenu: function () { var that = this; $(document).ready(function () { $('.header_wap_menu').menu(); //关于我们 页码 $('.about_item_link').click(function (e) { e.preventDefault(); if ($(this).attr('href') == 'javascript:;') { that.AboutPageTab.slideTo($(this).attr('data-id')); $('.header_wrap').removeClass('header_wap_active'); that.WapNavIF = true; console.log('进入第' + $(this).attr('data-id')); } }); $('.header_down_about_link').click(function (e) { e.preventDefault(); if ($(this).attr('href') == 'javascript:;') { var index ; //that.AboutPageTab.slideTo($(this).attr('data-id')); if($(this).attr('flag')==1){ index = 5+$(this).parent().index() }else { index = $(this).parent().index() } that.AboutPageTab.slideTo(index); $('.header_wrap').removeClass('header_wap_active'); } }); //ky体育app网站入口 页码 $('.pro_item_link').click(function (e) { e.preventDefault(); if ($(this).attr('href') == 'javascript:;') { that.ProPageTab.slideTo($(this).attr('data-id')); $('.pro_banner_item_box').eq($(this).attr('data-id')).addClass('pro_banner_item_active').siblings().removeClass('pro_banner_item_active'); $(document.body).animate({ scrollTop: $('.pro_page_wrap').offset().top - $('.header_wrap').height() - ($('.pro_banner_list').height()) }, 700); $('html').animate({ scrollTop: $('.pro_page_wrap').offset().top - $('.header_wrap').height() - ($('.pro_banner_list').height()) }, 700); $('.header_wrap').removeClass('header_wap_active'); that.WapNavIF = true; console.log('进入第' + $(this).attr('data-id')); } }); }); }, //底部 footAnimate: function () { var that = this; if (that.Width > 1200) { $(function () { var FootWrap = $('.inner_page_wrap'); var FootContent = $('.inner_page_animate'); // console.log(FootContent.height()); FootWrap.css({ height: parseInt(FootContent.height()) + 'px' }); var scrollTop = $(window).scrollTop(); if (FootContent.length > 0) { var footerHeight = FootWrap.offset().top - scrollTop - that.Height; if (footerHeight <= 0) { FootContent.css({ WebkitTransform: 'translateY(' + parseInt(Math.abs(footerHeight / 2.5)) + 'px)', transform: 'translateY(' + parseInt(Math.abs(footerHeight / 2.5)) + 'px)', }); var ToOpacity = 1 / (FootContent.height() / 2.5); $('.footer_content_box').css({ opacity: parseInt(Math.abs(footerHeight / 2.5)) * ToOpacity }); } } $(window).scroll(function () { var scrollTop = $(window).scrollTop(); if (FootContent.length > 0) { var footerHeight = FootWrap.offset().top - scrollTop - that.Height; if (footerHeight <= 0) { FootContent.css({ WebkitTransform: 'translate3d(0,' + parseInt(Math.abs(footerHeight / 2.5)) + 'px,0)', transform: 'translate3d(0,' + parseInt(Math.abs(footerHeight / 2.5)) + 'px,0)' }); var ToOpacity = 1 / FootContent.height(); $('.footer_content_box').css({ opacity: parseInt(Math.abs(footerHeight)) * ToOpacity }); } } }); }) } }, //导航高亮 navHover: function () { $('.public_nav_item').hover(function () { $('.public_nav_item').addClass('public_nav_default'); $('.public_nav_item').eq($(this).index()).addClass('public_nav_hover'); }, function () { $('.public_nav_item').removeClass('public_nav_default public_nav_hover'); }); }, //滚动条 Scrollbar: function () { setInterval(function () { $('body').getNiceScroll().resize(); }, 300); var that = this; if (that.Width > 1200) { $(document).ready(function () { $("body").niceScroll({ zindex: "99999", //滚动条颜色 cursorcolor: "rgba(255,255,255,0)", // 当滚动条是隐藏状态时改变透明度,值范围1到0 cursoropacitymin: 0, // 当滚动条是显示状态时改变透明度,值范围1到0 cursoropacitymax: 1, //使光标拖动滚动像在台式电脑触摸设备 true滚动条拖动不可用 touchbehavior: false, // 隐藏滚动条的方式,可用的值:true|无滚动时隐藏,"cursor"|隐藏,false|不隐藏,"leave"|仅在指针离开内容时隐藏,"hidden"|一直隐藏,"scroll"|仅在滚动时显示 autohidemode: true, //启用滚动跳跃的内容移动 bouncescroll: true, //可以使用 CSS 变型来滚动内容 enabletranslate3d: true, // niceScroll 可以管理水平滚动 horizrailenabled: false, //背景滚动槽颜色 background: "rgba(211,211,211,0)", //滚动条宽度 cursorwidth: "3px", //滚动条两头的圆角 cursorborderradius: "0", //滚动条的位置 railpadding: { top: 0, right: 0, left: 0, bottom: 0 }, //可以管理鼠标滚轮事件 enablemousewheel: true, //可以管理键盘事件 enablekeyboard: true, //滚动速度 scrollspeed: 60, smoothscroll: 'ease', hidecursordelay: 400, // 鼠标滚动的滚动速度(像素) mousescrollstep: 9 * 2, //仅 boxzoom=true 和触屏设备时有效)激活变焦当 out/in (两个手指外账或收缩) gesturezoom: false, //你可以用鼠标滚动可滚动区域的滚动条和增加鼠标滚轮事件 preservenativescrolling: true, //当按下空格时使页面向下滚动 spacebarenabled: true, //防止多触点时间引发滚动 preventmultitouchscrolling: true, }); }); that.NavScroll(); } else { $('body').addClass('body_show'); that.NavScroll(); } }, //获取TOP NavScroll: function () { var that = this; that.scrollTop = document.documentElement.scrollTop || document.body.scrollTop; that.NavScrollTop(); // console.log("滚动距离" + that.scrollTop); window.onscroll = function () { that.scrollTop = document.documentElement.scrollTop || document.body.scrollTop; that.NavScrollTop(); // console.log("滚动距离" + that.scrollTop); }; }, //判断top值 NavScrollTop: function () { var that = this; that.scrollTop = $(window).scrollTop(); that.scrollTop = document.documentElement.scrollTop || document.body.scrollTop; //移动端首页导航 if (that.scrollTop > 20) { $('.header_wrap').addClass('header_active'); } else { $('.header_wrap').removeClass('header_active'); } if ($('.pro_banner_fixed').length > 0) { var ProTop = $('.header_wrap').height() + $('.pro_banner_list').height(); if (that.scrollTop + ProTop > $('.pro_page_wrap').offset().top) { console.log('到了'); $('.pro_banner_list').addClass('pro_banner_animate'); } else { $('.pro_banner_list').removeClass('pro_banner_animate'); } } that.FadeInUp(); that.SolutionBanner(); that.SolutionHead(); that.SolutionContent(); that.ProBanner(); that.ProItem(); that.ProDetailsBanner(); // that.ProDetailsTips(); that.ProDataBjq(); that.ProRelatedHead(); that.ProRelatedItem(); that.NewBanner(); that.NewContent(); that.ContactWap(); that.SolutionList(); }, //进场 FadeInUp: function () { var that = this; var Item = $('.FadeInUp'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('AddFadeInUp'); } } } }, SolutionBanner: function () { var that = this; var Item = $('.solution_page_banner_content'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('SolutionBannerShow'); } } } }, SolutionHead: function () { var that = this; var Item = $('.solution_page_head'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('SolutionHeadShow'); } } } }, SolutionContent: function () { var that = this; var Item = $('.solution_page_bjq p,.solution_page_bjq h1,.solution_page_bjq h2,.solution_page_bjq h3,.solution_page_bjq h4,.solution_page_bjq table'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('SolutionContentShow'); } } } }, ProBanner: function () { var that = this; var Item = $('.pro_banner_wrap'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('ProBannerShow'); } } } }, ProItem: function () { var that = this; var Item = $('.pro_page_item_box'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('ProItemShow'); } } } }, ProDetailsBanner: function () { var that = this; var Item = $('.pro_details_content'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('ProDetailsBannerShow'); } } } }, ProDetailsTips: function () { var that = this; var Item = $('.pro_details_tips_box'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('ProDetailsTipsShow'); } } } }, ProDataBjq: function () { var that = this; var Item = $('.pro_data_bjq p,.pro_data_bjq h1,.pro_data_bjq h2,.pro_data_bjq h3,.pro_data_bjq h4,.pro_data_bjq table'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('ProDataShow'); } } } }, ProRelatedHead: function () { var that = this; var Item = $('.pro_related_head'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('ProRelatedHeadShow'); } } } }, ProRelatedItem: function () { var that = this; var Item = $('.pro_related_item_box'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('ProRelatedItemShow'); } } } }, NewBanner: function () { var that = this; var Item = $('.news_page_banner_content'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('NewBannerShow'); } } } }, NewContent: function () { var that = this; var Item = $('.news_details_bjq p,.news_details_bjq h1,.news_details_bjq h2,.news_details_bjq h3,.news_details_bjq h4,.news_details_bjq table'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('NewContentShow'); } } } }, ContactWap: function () { var that = this; var Item = $('.contact_page_content'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('ContactWapShow'); } } } }, SolutionList: function () { var that = this; var Item = $('.solution_list_content'); if (Item.length > 0) { for (var i = 0; i < Item.length; i++) { var Height = that.Height * 0.95; var Stop = that.scrollTop + Height; if (Stop > Item.eq(i).offset().top) { Item.eq(i).addClass('SolutionList'); } } } }, //返回顶部 ReturnTop: function () { var that = this; var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; $(document.body).animate({ scrollTop: 0 }, 700); $('html').animate({ scrollTop: 0 }, 700) }, //移动端导航 WapNav: function () { var that = this; var top = 0;//给top变量一个初始值,以便下方赋值并引用。 $('.header_wap_btn').on('click', function (e) { e.preventDefault(); if (that.WapNavIF) { $('.header_wrap').addClass('header_wap_active'); that.WapNavIF = false; // top = $(window).scrollTop(); // $('body').css("top", -top + "px"); // $('body').addClass('body_flex'); } else { $('.header_wrap').removeClass('header_wap_active'); that.WapNavIF = true; // $('body').removeClass('body_flex'); // $(window).scrollTop(top); } }); }, AboutNumber: function () { var that = this; if (that.NumberIf) { var numberL = $('.index_honor_number'); for (var i = 0; i < numberL.length; i++) { numberL.eq(i).html(that.Number[i]); } console.log(that.Number); $('.index_honor_number').each(function () { $(this).prop('counter', 0).animate({ counter: $(this).text() }, { duration: 1500, easing: 'swing', step: function (now) { now = Math.ceil(now); now = now.toString(); now = now.replace(/\B(?=(\d{3})+(?!\d))/g, ''); $(this).text(now); } }); }); that.NumberIf = false; } }, //锚点特效 maoAnimate: function () { var that = this; var _hash = window.location.hash; that.maoNumber = $('.header_after').height(); //锚点滑动 $('.anchor_link').click(function () { var $target = $(this.hash); $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']'); if ($target.length) { var targetOffset = $target.offset().top; $('html,body').animate({ scrollTop: targetOffset - that.maoNumber }, 700); return false; } }); setTimeout(function () { if (_hash && $(_hash).get(0)) { $('html,body').animate({ scrollTop: $(_hash).offset().top - that.maoNumber }, 700); } }, 500); }, //parallax IndexParallax: function () { $('.ParallaxScene').parallax(); }, //Loading Loading: function () { var that = this; var LoadItem = $('.loading_img'); for (var i = 0; i < LoadItem.length; i++) { if (LoadItem.eq(i).attr('src') == "") { console.log('少图'); } else { that.ImgArray.push( LoadItem.eq(i).attr('src') ); } } //去重Img if (that.ImgArray.length > 0) { function unique2(array) { array.sort(); var re = [array[0]]; for (var i = 1; i < array.length; i++) { if (array[i] !== re[re.length - 1]) { re.push(array[i]); } } return re; } that.allImages = unique2(that.ImgArray); } console.log(that.allImages); // that.SvgTimeOver = setInterval(function () { // that.SvgTime += 10; // if (that.SvgTime >= 2200 && that.ImagesLoad) { // clearInterval(that.SvgTimeOver); // that.SvgTime = 0; // // } // }, 10); //初始化 if ($('.loading_wrap').length > 0 && that.allImages.length > 0) { function handleComplete() { console.log('加载成功'); $('.loading_wrap').addClass('loading_animate'); setTimeout(function () { $('.loading_wrap').remove(); that.Init(); }, 1100) } var queue = new createjs.LoadQueue(); queue.installPlugin(createjs.Sound); queue.loadManifest(that.allImages); queue.on("fileload", function (e) { // $('.loading_schedule_box').stop().show(); }); //监听进度事件 queue.on("progress", function (e) { var proNum = Math.ceil(e.progress * 100); $('.loading_number').html(proNum); $('.loading_logo_box').css({ width: proNum + "%" }) $('.loading_line_after').css({ width: proNum + "%" }) if (proNum >= 100) { that.ImagesLoad = true; } }); queue.on("complete", handleComplete, this); } else { // $('.loading_wrap').remove(); that.Init(); } }, //默认方法 HtmlInit: function () { var that = this; $('body').addClass('body_animate'); $('.header_wrap').addClass('header_show'); that.AddEventList(); that.footAnimate(); //add that.Scrollbar(); that.WapNav(); that.maoAnimate(); that.IndexPageSwiper(); that.IndexBannerSwiper(); that.IndexProSwiper(); that.IndexNewsSwiper(); that.AboutPageSwiper(); that.AboutCompanySwiper(); that.ProPageSwiper(); that.ContactSwiper(); that.HeaderDownSwiper(); that.HeaderMenu(); }, }; $(function () { IqwXiongJs.Loading(); // IqwXiongJs.Init(); });