$(function() { var url = window.location.href; if(url.indexOf('aspx') < 0 && url.indexOf('html') > 0) { // 澶撮儴鍔犺浇 $("#header").load("comHead.html"); $("#footer").load("comFoot.html"); } if(location.href.indexOf('index.aspx') < 0) { $("#header .nav a").each(function() { var urlstr = location.href; var thisHref = $(this).attr('href'); var nav_name = thisHref.replace(/(.*\/)*([^.]+).*/ig, "$2").replace(/\d+/g, ''); if(thisHref !== '/' && (urlstr + '/').indexOf(thisHref) > -1 && $(this).attr('href') != '') { $(this).addClass('act'); return false; } else { thisHref = false; } // if(!thisHref) { // $("#header .nav a").eq(0).addClass('act'); // } }); } var legalPop = $(".popLegal"); $("#footer").on('click', '.legalIn', function() { legalPop.fadeIn() }) $(".popLegal .close-area").click(function() { legalPop.fadeOut() }) var w_wid = $(window).width(); w_wid = w_wid > 1300 ? w_wid : 1300; if($("#banner").length) { // var _percent = (w_wid - 1310) / 2 / w_wid; // $(".swiper-container .swiper-slide").each(function() { // $(this).find(".txt").css({ // "left": _percent * 100 + "%" // }); // }); // setBan(); // $(".swiper-button-next").click(); var _video = $("#banner video")[0]; var timer; jQuery("#banner").slide({ mainCell: ".swiper-wrapper", // autoPlay: true, effect: "fold", interTime: 4000, delayTime: 800, mouseOverStop: false, prevCell: '.swiper-button-prev', nextCell: '.swiper-button-next', startFun: function(i, c) { if(i === 0) { // _video.load(); // _video.currentTime = 0; // $("video")[0].load(); if(!isNaN(_video.duration)) { _video.currentTime = 0; } _video.play(); } else { _video.pause(); } }, endFun: function(i, c) { clearTimeout(timer); if(i === 0) { timer = setTimeout(function() { $(".swiper-button-next").click() }, 7000) } else { timer = setTimeout(function() { $(".swiper-button-next").click() }, 5000) } } }); $(window).resize(function () { $("#banner .swiper-wrapper,#banner .swiper-slide").css("width", "100%"); initBannerVideo(); // var hei = $("#banner .swiper-slide").height(); }); initBannerVideo(); function initBannerVideo() { $('#banner .swiper-slide').each(function () { var $this = $(this); if ($this.find('video') == undefined) return; var width = $(this).width() > 2200 ? 2200 : $(this).width(); var height = (width-10) * 720 / 2200; height = height.toFixed(0); $this.find('video').width(width); $this.find('video').height(height); console.log(height); //$this.height(height); $this.find('video').attr('scr', $this.attr('scr')); // $this.find('video').load(); $("#banner").height(height); }); } var txtw = $('.demo .img .textbox .txtw'); jQuery(".demo .img").slide({ mainCell: ".swiper-wrapper", autoPlay: true, effect: "fold", interTime: 4000, delayTime: 800, mouseOverStop: false, titCell: '.hd ul', autoPage: true, startFun: function(i, c) { txtw.eq(i).stop().fadeIn().siblings().stop().fadeOut() } }); } if($(".wow").length) { if(!(/msie [6|7|8|9]/i.test(navigator.userAgent))) { var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 20, // 璺濈鍙鍖 瑙﹀彂鍔ㄧ敾 mobile: true, live: true }); wow.init(); } } function setBan(obj, li, prev_btn, next_btn) { var dot = "
"; var list_li = $(".swiper-container .swiper-slide"); for(i = 0; i < list_li.length; i++) { $(".swiper-pagination").append(dot); }; function setDot() { $(".swiper-pagination .swiper-pagination-bullet").removeClass("swiper-pagination-bullet-active").eq(i - 1).addClass("swiper-pagination-bullet-active"); } var _timer; var _first = list_li.last().clone().removeClass("on"); var _last = list_li.first().clone().removeClass("on"); list_li.parent().prepend(_first); list_li.parent().append(_last); var _length = $(".swiper-container .swiper-slide").length; var par_wid = $(".swiper-container").width(); $(".swiper-container .swiper-slide .bg").width(par_wid); $(window).resize(function() { par_wid = $(".swiper-container").width(); $(".swiper-container .swiper-slide .bg").width(par_wid); }); var i = $(".swiper-container .swiper-slide.on").index(); setDot(); var _switch = true; $(".swiper-container .swiper-slide").eq(i - 1).addClass("on_prev"); $(".swiper-container .swiper-slide").eq(i + 1).addClass("on_next"); $(".swiper-button-prev").click(function() { if(_switch) { _switch = false; // 瑙嗛 //video[0].currentTime=0; //video[0].pause(); // 瑙嗛-end i--; if(i == 0) { i = _length - 2; } setDot(); $(".swiper-container .swiper-slide").css({ "left": "auto", "right": "0" }); $(".swiper-container .swiper-slide.on .bg").css({ "float": "right" }); $(".swiper-container .swiper-slide.on").animate({ "width": 0 }, 1000); $(".swiper-container .swiper-slide.on_prev").css({ "width": "100%", "zIndex": 4, "right": "30%" }).animate({ "right": 0 }, 1000); $(".swiper-container .swiper-slide.on_next").css({ "width": "100%", "zIndex": 3 }); $(".swiper-container .swiper-slide.on .txt").animate({ "opacity": 0, "filter": "alpha(opapity=0)" }, 500, function() { $(this).css({ "marginLeft": "100px" }) }); setTimeout(function() { $(".swiper-container .swiper-slide .txt").css({ "opacity": 0, "filter": "alpha(opapity=100)", "marginLeft": "100px" }); $(".swiper-container .swiper-slide .bg").css({ "float": "left" }); $(".swiper-container .swiper-slide").eq(i).find(".txt").animate({ "opacity": 1, "filter": "alpha(opapity=1)", "marginLeft": "0" }, 1000); $(".swiper-container .swiper-slide").removeClass('on on_prev on_next').eq(i).addClass("on").css({ "zIndex": 5, "width": "100%" }).siblings().css({ "width": "100%", "left": 0, "right": "auto", "zIndex": 2 }); $(".swiper-container .swiper-slide").eq(i - 1).addClass("on_prev").css({ "left": "auto", "right": "30%", "zIndex": 4 }); $(".swiper-container .swiper-slide").eq(i + 1).addClass("on_next").css({ "left": "30%", "zIndex": 3 }); _switch = true; if($(".swiper-container .swiper-slide.on video").length) { video[0].play(); clearInterval(_timer); // 瑙嗛 //videoEnd(); } }, 1000); clearInterval(_timer); _timer = setInterval(function() { $(".swiper-button-next").click(); }, 5000); } }); $(".swiper-button-next").click(function() { if(_switch) { _switch = false; // 瑙嗛 //video[0].currentTime=0; //video[0].pause(); // 瑙嗛-end i++; if(i == _length - 1) { i = 1; } setDot(); $(".swiper-container .swiper-slide").css({ "left": "0", "right": "auto" }); $(".swiper-container .swiper-slide.on").animate({ "width": 0 }, 1000); $(".swiper-container .swiper-slide.on_prev").css({ "width": "100%", "zIndex": 3 }); $(".swiper-container .swiper-slide.on_next").css({ "width": "100%", "zIndex": 4, "left": "30%" }).animate({ "left": 0 }, 1000); $(".swiper-container .swiper-slide.on .txt").animate({ "opacity": 0, "filter": "alpha(opapity=0)" }, 500, function() { $(this).css({ "marginLeft": "100px" }) }); setTimeout(function() { $(".swiper-container .swiper-slide .txt").css({ "opacity": 0, "filter": "alpha(opapity=100)", "marginLeft": "100px" }); $(".swiper-container .swiper-slide").eq(i).find(".txt").animate({ "opacity": 1, "filter": "alpha(opapity=1)", "marginLeft": "0" }, 1000); $(".swiper-container .swiper-slide").removeClass('on on_prev on_next').eq(i).addClass("on").css({ "zIndex": 5, "width": "100%" }).siblings().css({ "width": "100%", "left": 0, "right": "auto", "zIndex": 2 }); $(".swiper-container .swiper-slide").eq(i - 1).addClass("on_prev").css({ "left": "auto", "right": "30%", "zIndex": 3 }); $(".swiper-container .swiper-slide").eq(i + 1).addClass("on_next").css({ "left": "30%", "zIndex": 4 }); _switch = true; if($(".swiper-container .swiper-slide.on video").length) { video[0].play(); clearInterval(_timer); // 瑙嗛 //videoEnd(); } }, 1000); clearInterval(_timer); _timer = setInterval(function() { $(".swiper-button-next").click(); }, 5000); } }); _timer = setInterval(function() { $(".swiper-button-next").click(); }, 5000); } })