//ie8 window.onload=function(){ if(navigator.appName == "Microsoft Internet Explorer"&&parseInt(navigator.appVersion.split(";")[1].replace(/[ ]/g, "").replace("MSIE",""))<=9){ document.body.innerHTML += '
'; } } //滚动加载移除css var $window = $(window); var $ani_elements = $('.indexCon1,.indexCon2,.indexCon3,.indexCon4'); function check_ani() { var window_height = $window.height(); var window_top_position = $window.scrollTop(); var window_bottom_position = (window_top_position + window_height - 100); $ani_elements.each(function () { var $element = $(this); var element_height = $element.outerHeight(); var element_top_position = $element.offset().top; var element_bottom_position = (element_top_position + element_height); if ((element_bottom_position >= window_top_position) && (element_top_position <= window_bottom_position)) { $element.addClass('animation'); } else { //$element.removeClass('animation'); } }); } $window.on('load scroll', function () { check_ani(); }); //rem fontSize(); $(window).resize(function () { fontSize(); }); function fontSize() { var size; var winW = window.innerWidth; if (winW <= 1440 && winW > 1040) { size = Math.round(winW / 16); } else if (winW <= 960) { size = 90; } else { size = 100; } $('html').css({ 'font-size': size + 'px' }) } //导航 $(function() { var vNavWaitSlide, NavWaitSlide; $('.nav ul>li').hover( function() { $(this).find('a:first').addClass("hover"); var current_li = $(this), targ = $(current_li).find('ol:first'); NavWaitSlide = setTimeout(function() { if (!$(targ).is(':visible')) { $(targ).slideDown(200); } }, 100) }, function() { clearTimeout(NavWaitSlide); $(this).find('ol').hide(); $(this).find('a:first').removeClass("hover"); } ); }) //移动端导航 $(document).ready(function() { $(".menu1").click(function() { $(".m_nav").toggleClass("active"); $("body").toggleClass("navshow"); $(this).toggleClass("open"); }); $(".m_nav ul>li>i").click(function() { $(this).toggleClass("on"); $(this).siblings(".m_nav ul ol").slideToggle(); $(this).parent().siblings().find('i').removeClass('on'); $(this).parent().siblings().find('ol').slideUp(); $(this).parent().siblings().find('ul').slideUp(); }); $(".m_nav ul li ol li i").click(function() { $(this).toggleClass("on"); $(this).siblings(".nav2 ul li ol li ul").slideToggle(); }); }); function swiperFun(swiper) { this.dom = swiper.dom; this.domList = this.dom; this.dom.find('ul').addClass('swiper-wrapper'); this.dom.find('li').addClass('swiper-slide'); if(swiper.domList !== undefined){ this.domList = this.dom.find(swiper.domList) } if(this.dom.find('.num').length > 0){ this.dom.find('.num-total').html(this.dom.find('li').length) } this.change = function () {}; var that = this; this.mySwiper = new Swiper(that.domList, { loop: swiper.loop !== undefined ? swiper.loop : true, autoplay: swiper.autoplay !== undefined ? swiper.autoplay : 5000, autoplayDisableOnInteraction: false, paginationClickable: true, speed: 600, slidesPerView: swiper.slidesPerView !== undefined ? swiper.slidesPerView : 1, slidesPerGroup: swiper.slidesPerGroup !== undefined ? swiper.slidesPerGroup : 1, centeredSlides: swiper.centeredSlides !== undefined ? swiper.centeredSlides : false, slideToClickedSlide: swiper.slideToClickedSlide !== undefined ? swiper.slideToClickedSlide : false, roundLengths: swiper.roundLengths !== undefined ? swiper.roundLengths : false, pagination: that.dom.find('.dots'), onSlideChangeStart: function(swiper){ if(that.dom.find('.num').length > 0){ that.dom.find('.num-curr').html(swiper.realIndex + 1) } that.change(swiper.realIndex); } }); } /* 搜索 */ $(".linkTop .search").click(function(){ $(".layer").addClass("showdiv"); $("body").addClass("active"); $(".layer .close").click(function(){ $(".layer").removeClass("showdiv"); $("body").removeClass("active"); }) });