window.onload = function() { bindEvent(); }; function bindEvent() { //鎺у埗鏄剧ず鏂囨湰鐪佺暐鍙 $('.news_box li h3').dotdotdot(); $('.news_box li p').dotdotdot(); // 鍒ゆ柇IE骞舵墽琛屼笉鍚屼簨浠 var IEVersion = getIEVersion(); if(IEVersion && IEVersion <= 9) { lteIE9SwiperEvt(); if(IEVersion <= 8) { lteIE8Evt(); } } else { swiperEvent(); } // 鍒ゆ柇鏄惁鐏嫄骞舵墽琛屼簨浠 if (navigator.userAgent.indexOf('Firefox') >= 0) { $('.video_placeholder').click(function() { alert('鐏嫄涓嶆敮鎸佽瑙嗛鎾斁绫诲瀷,璇风敤鍏朵粬娴忚鍣ㄨ鐪?); }); } else { // 鏄剧ず瑙嗛浜嬩欢 setTimeout(function() { $('.video_placeholder').fadeOut(); }, 1000); } //鑽h獕璧勮川棰勮鏁堟灉 $('.honor_slide img').click(function() { var imgUrl = $(this).attr('src'); previewHonorImg(imgUrl); }); } // 棰勮杞挱鍥剧墖浜嬩欢 function previewHonorImg(imgUrl) { if($('.honor_modal_box')) { $('.honor_modal_box').remove(); } console.log(2); var honorStr = '
'; $('body').append(honorStr); setTimeout(function() { $('.honor_modal_box').addClass('show'); }, 200); $('.honor_modal_box').click(function() { $('.honor_modal_box').removeClass('show'); }) } // 杞挱浜嬩欢 function swiperEvent() { // 杞挱浜嬩欢 var mySwiper1 = new Swiper('.main_swiper_container', { pagination: '.swiper-pagination', paginationClickable: true, loop: true, autoplay: 5000, speed: 750, autoplayDisableOnInteraction: false, simulateTouch : false, prevButton:'.swiper-button-prev', nextButton:'.swiper-button-next' }); $('.main_swiper_container').mouseenter(function() { mySwiper1.stopAutoplay() }); $('.main_swiper_container').mouseleave(function() { mySwiper1.startAutoplay() }); var mySwiper2 = new Swiper('.honor_swiper_container', { loop: true, autoplay: false, speed: 550, autoplayDisableOnInteraction: false, prevButton:'.btn_prev', nextButton:'.btn_next', // slidesPerView : 5, slidesPerView :'auto', simulateTouch : false, slidesPerGroup : 1, // spaceBetween : 43, }); var coopSwiper = new Swiper('.coop_swiper', { loop: true, autoplay: 2500, speed: 550, autoplayDisableOnInteraction: false, slidesPerView : 5, slidesPerGroup : 1, simulateTouch : false, spaceBetween : 43, }); } // 浣庣増鏈琁E杞挱浜嬩欢 function lteIE9SwiperEvt() { // 杞挱浜嬩欢 var mySwiper1 = new Swiper('.main_swiper_container', { pagination: '.swiper-pagination', loop: true, autoplay: 3000, speed: 750, autoplayDisableOnInteraction: false, simulateTouch : false, // prevButton:'.swiper-button-prev', // nextButton:'.swiper-button-next' }); $('.swiper-button-prev').click(function(){ mySwiper1.swipePrev(); }); $('.swiper-button-next').click(function(){ mySwiper1.swipeNext(); }); var mySwiper2 = new Swiper('.honor_swiper_container', { // loop: true, autoplay: false, autoplayDisableOnInteraction: false, // slidesPerView : 5, slidesPerView :'auto', simulateTouch : false, // slidesPerGroup : 1, // spaceBetween : 43, }); $('.btn_prev').click(function(){ mySwiper2.swipePrev(); }); $('.btn_next').click(function(){ mySwiper2.swipeNext(); }); var coopSwiper = new Swiper('.coop_swiper', { loop: true, autoplay: 2500, speed: 500, autoplayDisableOnInteraction: false, slidesPerView : 5, slidesPerGroup : 1, simulateTouch : false, // spaceBetween : 43, }); // $('.expert_swiper_container').mouseover(function(){ // mySwiper2.stopAutoplay(); // }); // $('.expert_swiper_container').mouseout(function(){ // mySwiper2.startAutoplay(); // }); } // IE8鎴栨洿浣庣増鏈鐞 function lteIE8Evt() { // 棣栭〉banner杞挱淇敼 // $('.swiper-button-prev, .swiper-button-next').css({'display': 'none'}); // $('.main_swiper_container .swiper-slide').css({'background-size': 'auto 720px'}); // 鑽h獕璧勮川淇敼 // $('.horder_box').css({'height': 'auto'}); // $('.honor_slide').css({'margin-right': '115px', 'margin-bottom': '25px'}); // $('.honor_slide:nth-child(4n)').css({'margin-right': '0'}); // $('.btn_prev, .btn_next').css({'display': 'none'}); //鎴樼暐鍚堜綔淇敼 $('.coop_show:nth-child(5n)').css({'margin-right': '0'}); } // 鑾峰彇IE鐗堟湰 function getIEVersion() { var userAgent = navigator.userAgent; //鍙栧緱娴忚鍣ㄧ殑userAgent瀛楃涓 var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //鍒ゆ柇鏄惁IE娴忚鍣 if (isIE) { var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); reIE.test(userAgent); var fIEVersion = parseFloat(RegExp["$1"]); if (fIEVersion == 7) { return 7; } else if (fIEVersion == 8) { return 8; } else if (fIEVersion == 9) { return 9; } else if (fIEVersion == 10) { return 10; } else if (fIEVersion == 11) { return 11; } else { return 0 }//IE鐗堟湰杩囦綆 } }