锘 //var medias = Array.prototype.slice.apply(document.querySelectorAll('audio,video')); //medias.forEach(function (media) { // media.addEventListener('play', function (event) { // medias.forEach(function (media) { // if (event.target != media) media.pause(); // }); // }); //}); $(function () { //document.getElementById('appVideo').play(); //document.addEventListener("tocustart", function () { // var video = document.getElementById("appVideo"); // video.play(); //}) //document.addEventListener("WeixinJSBridgeReady", function () { // document.getElementById("appVideo").play(); //}, false); var ww = $(window).width(); var wh = $(window).height(); var bw1 = 1920; var bh1 = 1080; var bw2 = 1920; var bh2 = 983; var nh1 = bw1 / ww * bh1; var nh2 = bw2 / ww * bh2; if (wh - nh1 > wh - nh2) { // 鐢╞w2鐨勫浘鐗 //$(".bannerList ").addClass("b2").removeClass("b1"); $("#J_banner5").hide(); $("#J_banner").show(); } else { $("#J_banner5").show(); $("#J_banner").hide(); // 鐢╞w1鐨勫浘鐗 //$(".bannerList ").addClass("b1").removeClass("b2"); } function setHeader() { var navHeight = $(".header").height(); var scrollTop = $(window).scrollTop(); if (scrollTop > navHeight) { $(".header").addClass("on") } else { $(".header").removeClass("on") } } $(window).scroll(function () { setHeader() }); setHeader(); var firPlay = true; //鍒ゆ柇鏄笉鏄涓€娆★紙鎵嬪姩鐐瑰嚮锛岄潪杞挱鍥捐烦杞Е鍙戯級鎾斁瑙嗛 function videoPlay(swiper) { if (!firPlay) { // 褰撳墠娲诲姩蹇湁瑙嗛 console.log(swiper) var jqVideo = $(swiper.slides[swiper.activeIndex]).find("video"); console.log(jqVideo) console.log(jqVideo.length > 0) if (jqVideo.length > 0) { var _videoObj = jqVideo[0]; console.log(_videoObj) swiper.stopAutoplay(); _videoObj.play(); _videoObj.addEventListener('ended', function () { swiper.slideNext(); swiper.startAutoplay(); }, false); } } }; $(".aboutVideo .videoBg").click(function () { var jqVideo = $("#aboutVideo"); jqVideo[0].play(); jqVideo.attr("controls", "controls") $(this).hide(); }) var bannerLength = $("#J_banner li").length; var swiperB = new Swiper('#J_banner', { slidesPerView: 1, // init: false, autoplay: bannerLength > 1 ? 5000 : false, autoplayDisableOnInteraction: false, speed: 500, loop: bannerLength > 1 ? true : false, pagination: '.banner-pagination', nextButton: '.banner-next', prevButton: '.banner-prev', onInit: function(swiper){ //Swiper鍒濆鍖栦簡 //alert(swiper.activeIndex);鎻愮ずSwiper鐨勫綋鍓嶇储寮 }, onSlideChangeStart: function (swiperC) { // alert(swiper.activeIndex) //鍒囨崲缁撴潫鏃讹紝鍛婅瘔鎴戠幇鍦ㄦ槸绗嚑涓猻lide // 鍒囨崲鏄厛鏆傚仠鎵€鏈夎棰戞挱鏀 $(swiperC.slides).each(function () { var jqVideo = $(this).find("video") if (jqVideo.length > 0) { jqVideo[0].pause(); if (!firPlay) jqVideo[0].currentTime = 0 } }) videoPlay(swiperC); } }); var bannerLength = $("#J_banner2 li").length; var swiper2 = new Swiper('#J_banner2', { slidesPerView: 1, // init: false, autoplay: bannerLength > 1 ? 5000 : false, autoplayDisableOnInteraction: false, speed: 500, loop: bannerLength > 1 ? true : false, pagination: '.banner-pagination', nextButton: '.banner-next', prevButton: '.banner-prev', }); var bannerLength5 = $("#J_banner5 li").length; var swiper5 = new Swiper('#J_banner5', { slidesPerView: 1, // init: false, autoplay: bannerLength5 > 1 ? 5000 : false, autoplayDisableOnInteraction: false, speed: 500, loop: bannerLength5 > 1 ? true : false, pagination: '.banner5-pagination', nextButton: '.banner5-next', prevButton: '.banner5-prev', onSlideChangeStart: function (swiperC) { // alert(swiper.activeIndex) //鍒囨崲缁撴潫鏃讹紝鍛婅瘔鎴戠幇鍦ㄦ槸绗嚑涓猻lide // 鍒囨崲鏄厛鏆傚仠鎵€鏈夎棰戞挱鏀 $(swiperC.slides).each(function () { var jqVideo = $(this).find("video") if (jqVideo.length > 0) { jqVideo[0].pause(); if (!firPlay) jqVideo[0].currentTime = 0 } }) videoPlay(swiperC); } }); var bannerLengthM = $("#J_bannerM li").length; var swiperM = new Swiper('#J_bannerM', { slidesPerView: 1, // init: false, autoplay: bannerLengthM > 1 ? 5000 : false, autoplayDisableOnInteraction: false, speed: 500, loop: bannerLengthM > 1 ? true : false, pagination: '.banner5-pagination', nextButton: '.banner5-next', prevButton: '.banner5-prev', }); $(".play1").click(function () { firPlay = false; //var jqVideo = $(".bannerVideo"); $(".play1").hide(); //jqVideo[0].play(); videoPlay(swiperB) }); $(".play5").click(function () { firPlay = false; //var jqVideo = $(".bannerVideo"); $(".play5").hide(); //jqVideo[0].play(); videoPlay(swiper5) }); if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))) { var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', mobile: false }); wow.init(); }; $('.countup').countUp(); });