$(function(){
function detectbrowser () {
var agent = navigator.useragent.tolowercase();
var browser;
if ( (agent.indexof('msie') > -1) || (agent.indexof('trident') > -1) || (agent.indexof('edge') > -1) ) {
browser = 'ie'
}else if(agent.indexof('firefox') > -1) {
browser = 'firefox'
}else if(agent.indexof('opr') > -1) {
browser = 'opera'
}else if(agent.indexof('chrome') > -1) {
browser = 'chrome'
}else if(agent.indexof('safari') > -1) {
browser = 'safari'
}
return browser;
}
var $mainvisual = $(".main-visual-slider");
var $mainvisualitem = $mainvisual.find(".main-visual-item");
var $mainloadingbar = $mainvisual.find(".main-visual-loading-bar > span");
var $maincounter = $mainvisual.find(".main-visual-conuter");
var mainvisuallength = $mainvisualitem.length;
if ( detectbrowser () === "ie" ) {
$(".main-visual-slider .overlay").remove();
}
var interleaveoffset = .85;
var autoplayspeed = 4000;
var swiperoptions = {
loop: true,
speed: 1200,
parallax: false,
draggable: false,
autoplay: {
delay: autoplayspeed,
disableoninteraction: false
},
allowtouchmove:false,
watchslidesprogress: true,
pagination: {
el: '.main-visual-pagination',
clickable: true,
renderbullet: function (index, classname) {
return '
';
}
},
navigation: {
nextel: '.main-visual-slider .slide-next-btn',
prevel: '.main-visual-slider .slide-prev-btn'
},
on: {
init : function () {
$maincounter.find(".total-num").text("0"+ mainvisuallength);
},
progress: function () {
var swiper = this;
for (var i = 0; i < swiper.slides.length; i++) {
var slideprogress = swiper.slides[i].progress;
var inneroffset = swiper.width * interleaveoffset;
var innertranslate = slideprogress * inneroffset;
/* swiper.slides[i].queryselector(".slide-inner").style.transform =
"translate3d(" + innertranslate + "px, 0, 0)"; */
if ( detectbrowser () !== "ie" ) {
tweenmax.set(swiper.slides[i].queryselector(".slide-inner"), {
x: innertranslate,
});
}
}
},
slidechange : function () {
},
slidechangetransitionstart : function(){
var cur_idx = $(this.slides[this.activeindex]).data("swiper-slide-index");
// zoom in
$mainvisualimage = $(".swiper-slide-active").find(".visual-img");
tweenmax.killtweensof($mainvisualimage);
tweenmax.fromto($mainvisualimage, 2, { transform: "scale(1.4)" }, {transform: "scale(1) rotate(0.002deg)",force3d: true,ease: circ.easeout,delay: 0});
// counter
$maincounter.find(".cur-num").text("0"+(cur_idx+1));
// loading motion
tweenmax.killtweensof($mainloadingbar);
tweenmax.set($mainloadingbar, { width: "0%" });
tweenmax.to($mainloadingbar, autoplayspeed / 1000, { width: "100%" });
// text motion
$mainvisualtext1 = $(".swiper-slide-active").find(".main-visual-tit span");
$mainvisualtext2 = $(".swiper-slide-active").find(".main-visual-txt span");
$mainvisualbutton = $(".swiper-slide-active").find(".main-visual-btn");
tweenmax.fromto($mainvisualtext1, 1, {transform: "translatey(100%)",autoalpha: 0}, {transform: "translatey(0%)",autoalpha: 1,force3d: true,ease: circ.easeout,delay: 0.3});
tweenmax.fromto($mainvisualtext2, 1, {transform: "translatey(100%)",autoalpha: 0}, {transform: "translatey(0%)",autoalpha: 1,force3d: true,ease: circ.easeout,delay: 0.7});
tweenmax.fromto($mainvisualbutton, 0.5, {transform: "translatey(100%)",autoalpha: 0}, {transform: "translatey(0%)",autoalpha: 1,force3d: true,ease: circ.easeout,delay: 1});
if($(".main-visual-slider.ar_web .swiper-slide-active video").length>0){
// 停止自动切换
// swiper.autoplay.stop();
// 动态增加id
swiper.autoplay.stop();
$(".main-visual-slider.ar_web .swiper-slide-active video").attr("id","video_01");
settimeout(function(){
var _video = document.queryselector('.main-visual-slider.ar_web .swiper-slide-active video');
// 播放视频
_video.play();
// 切换后重新播放视频
_video.currenttime = 0;
// 静音
_video.volume = 0;
// 监听视频播放结束
_video.addeventlistener('ended', function () {
swiper.slidenext();
//重新开始轮播banner
swiper.autoplay.start();
});
}, 100);
}
},
touchstart: function () {
var swiper = this;
for (var i = 0; i < swiper.slides.length; i++) {
swiper.slides[i].style.transition = "";
}
},
settransition: function (speed) {
var swiper = this;
if ( detectbrowser () !== "ie") {
for (var i = 0; i < swiper.slides.length; i++) {
swiper.slides[i].style.transition = speed + "ms";
swiper.slides[i].queryselector(".slide-inner").style.transition =
speed + "ms";
}
}
},
slidechangetransitionend: function(swiper){
//动态移除id
$(".main-visual-slider .swiper-slide-active video").attr("id","");
},
}
};
var swiper = new swiper(".main-visual-slider .swiper-container", swiperoptions);
if ($(window).width() < 1200) {
$(".main-visual-slider .swiper-slide-video").remove();
}
var swiper1 = new swiper('.list1_box', {
speed: 1000,
loop: true,
spacebetween: 0,
roundlength: true,
autoplay: { delay: 6000, stoponlastslide: false, disableoninteraction: false, },
direction: 'vertical',
});
$('.inotice_list_con .arr_prev').click(function(){
swiper1.slideprev();
})
$('.inotice_list_con .arr_next').click(function(){
swiper1.slidenext();
})
var swiper2 = new swiper('.list2_box', {
speed: 1000,
loop: true,
spacebetween: 0,
roundlength: true,
autoplay: { delay: 6000, stoponlastslide: false, disableoninteraction: false, },
});
$(".list7 li:first-child").addclass("on");
$(".list8 li").hide()
$(".zhicheng_box .content").each(function () {
var hd1 = $(this).find('.list7 li');
var bd1 = $(this).find('.list8 li');
bd1.eq(0).show();
hd1.hover(function () {
var index = $(this).index();
hd1.eq(index).addclass("on").siblings().removeclass("on");
bd1.eq(index).show().siblings().hide();
})
});
$(".home3_tit3").click(function(){
$(".zhicheng_box").removeclass("active");
});
$(".home3_tit6").click(function(){
$(".zhicheng_box").addclass("active");
});
$(".misotab .hd ul li:first-child").addclass("on");
$(".misotab .bd .bd_li").hide()
$(".misotab").each(function () {
var hd1 = $(this).find('.hd ul li');
var bd1 = $(this).find('.bd .bd_li');
bd1.eq(0).show();
hd1.click(function () {
var index = $(this).index();
hd1.eq(index).addclass("on").siblings().removeclass("on");
bd1.eq(index).show().siblings().hide();
})
});
var swiper3 = new swiper('.list9_box', {
speed: 1000,
spacebetween: 20,
roundlength: true,
//autoplay: { delay: 6000, stoponlastslide: false, disableoninteraction: false, },
// navigation: { nextel: '.slide-bb .next', prevel: '.slide-bb .prev', },
// pagination: { el: '.slidetab-b .swidotb', clickable: true, bulletactiveclass: 'active',type : 'progressbar' },
breakpoints: {
280: { slidesperview: 2, spacebetween: 0 },
900: { slidesperview: 3, spacebetween: 20 },
1280: { slidesperview: 4, spacebetween:20},
}
});
$('.miso_btn1 .prev').click(function(){
swiper3.slideprev();
})
$('.miso_btn1 .next').click(function(){
swiper3.slidenext();
})
$(".list10 li:first-child").addclass("on");
$(".list11 li").hide()
$(".home4 .content2").each(function () {
var hd1 = $(this).find('.list10 li');
var bd1 = $(this).find('.list11 li');
bd1.eq(0).show();
hd1.hover(function () {
var index = $(this).index();
hd1.eq(index).addclass("on").siblings().removeclass("on");
bd1.eq(index).show().siblings().hide();
})
});
var swiper4 = new swiper('.list16_box', {
speed: 1000,
loop: true,
spacebetween: 66,
roundlength: true,
autoplay: { delay: 6000, stoponlastslide: false, disableoninteraction: false, },
// navigation: { nextel: '.slide-bb .next', prevel: '.slide-bb .prev', },
// pagination: { el: '.slidetab-b .swidotb', clickable: true, bulletactiveclass: 'active',type : 'progressbar' },
breakpoints: {
280: { slidesperview: 2, spacebetween: 14 },
900: { slidesperview: 3, spacebetween: 20 },
1280: { slidesperview: 3, spacebetween: 30},
}
});
$('.miso_btn2 .prev').click(function(){
swiper4.slideprev();
})
$('.miso_btn2 .next').click(function(){
swiper4.slidenext();
})
});