var main = {
top:function(m){
$('#m' + m).addClass('active')
},
openvideo: function () {
$(document).on('click','.open-video',function (e) {
var files = $(this).attr('rel')
var title = $(this).attr('data-v-title') || '
'
if (title == '') {
var css = 'class="notitle"'
}
$('.video-box').remove()
if ($(window).width() <= 1024) {
$('body').append(
`
`
)
$('.video-box').fadeIn()
var myVideo = document.getElementById('video')
myVideo.play()
} else {
$('body').append(
`
`
)
$('.video-box').fadeIn()
}
videoclose()
})
$(document).on('click','.open-frame',function (e) {
var files = $(this).attr('rel')
var title = $(this).attr('data-v-title')
$('.video-box').remove()
if ($(window).width() <= 1024) {
$('body').append(
`
`
)
$('.video-box').fadeIn()
} else {
$('body').append(
`
`
)
$('.video-box').fadeIn()
}
videoclose()
})
function videoclose() {
$('.video-box .close').click(function (e) {
$('.video-box').remove()
})
}
},
home:function(){
$('.ind_ban .swiper-slide').each(function(i){
$(this).attr('data-index',i)
if($(this).find('video').length > 0){
$(this).addClass('has-video')
}
})
var isFirstVideo = $('.ind_ban .swiper-slide').eq(0).hasClass('has-video');
var banSwiper = new Swiper('.ind_ban .swiper', {
autoplay:{
delay:5000,
pauseOnMouseEnter: false,
disableOnInteraction: false,
},
pagination: {
el: ".swiper-pagination",
clickable:true
},
on: {
init: function() {
let delay = '4s'
if(this.originalParams.autoplay.enabled){
delay = (this.originalParams.autoplay.delay / 1000 * 2) + 's'
}
for (p = 1; p <= (this.slides.length ); p++) {
this.$el.find('.swiper-pagination').find('.swiper-pagination-bullet').html('')
}
},
slideChange: function(){
$('.ind_ban .pic').each(function(){
if($(this).find('video')[0]){
$(this).find('video')[0].pause()
}
})
},
slideChangeTransitionEnd: function () {
if( $('.ind_ban').find('.swiper-slide-active').length == 0) return
if($('.ind_ban').find('.swiper-slide-active').hasClass('has-video')){
banSwiper.autoplay.stop();
var videoElement = $('.ind_ban').find('.swiper-slide-active').find('video')[0]
videoElement.currentTime = 0
videoElement.play()
}else{
banSwiper.autoplay.start();
}
},
}
})
if(isFirstVideo){
banSwiper.autoplay.stop()
document.addEventListener('WeixinJSBridgeReady',function(){
$('.ind_ban .swiper-slide').eq(0).find('video')[0].play()
},false);
}
$('.ind_ban .has-video').each(function(){
$(this).find('video')[0].addEventListener("ended",function(){
banSwiper.slideNext()
});
})
// 鏅鸿兘浜х嚎
$('.ind_intell .item').hover(function(){
$(this).stop().addClass('big');
},function(){
$(this).stop().removeClass('big')
})
// 搴旂敤棰嗗煙
var appSwiper = new Swiper('.ind_App .swiper-container', {
slidesPerView: 2,
spaceBetween: 20,
pagination: {
el: ".ind_App .swiper-pagination",
clickable:true
},
autoplay:{
delay:5000,
pauseOnMouseEnter: false,
disableOnInteraction: false,
},
stopOnLastSlide: false,
on: {
init: function() {
let delay = '4s'
if(this.originalParams.autoplay.enabled){
delay = (this.originalParams.autoplay.delay / 1000 * 2) + 's'
}
for (p = 1; p <= (this.slides.length ); p++) {
$('.ind_App .swiper-pagination').find('.swiper-pagination-bullet').html('')
}
},
},
breakpoints: {
320: { //褰撳睆骞曞搴﹀ぇ浜庣瓑浜?20
slidesPerView: 1,
spaceBetween: 30
},
1024: { //褰撳睆骞曞搴﹀ぇ浜庣瓑浜?280
slidesPerView: 2,
spaceBetween: 20
}
}
})
// 鍚堜綔浼欎即
$('.ind_partner .swiper-wrapper').each(function(){
var list = $(this).find('.item');
if($(window).width() > 1024){
$(this).find('.item').each(function(i){
list.slice(i*18,i*18+18).wrapAll("");
})
}else if($(window).width() < 1024 && $(window).width() > 750){
$(this).find('.item').each(function(i){
list.slice(i*12,i*12+12).wrapAll("");
})
}else{
$(this).find('.item').each(function(i){
list.slice(i*6,i*6+6).wrapAll("");
})
}
})
var partnerSwiper = new Swiper('.ind_partner .swiper', {
slidesPerView: 1,
// spaceBetween: 20,
pagination: {
el: ".swiper-pagination",
clickable:true
},
autoplay:{
delay:5000,
pauseOnMouseEnter: false,
disableOnInteraction: false,
},
stopOnLastSlide: false,
on: {
init: function() {
let delay = '4s'
if(this.originalParams.autoplay.enabled){
delay = (this.originalParams.autoplay.delay / 1000 * 2) + 's'
}
for (p = 1; p <= (this.slides.length ); p++) {
this.$el.find('.swiper-pagination').find('.swiper-pagination-bullet').html('')
}
},
},
})
// 搴旂敤棰嗗煙
var newsSwiper = new Swiper('.ind_news .swiper', {
slidesPerView: 2,
spaceBetween: 20,
pagination: {
el: ".ind_news .swiper-pagination",
clickable:true
},
autoplay:{
delay:5000,
pauseOnMouseEnter: false,
},
stopOnLastSlide: false,
on: {
init: function() {
let delay = '4s'
if(this.originalParams.autoplay.enabled){
delay = (this.originalParams.autoplay.delay / 1000 * 2) + 's'
}
for (p = 1; p <= (this.slides.length ); p++) {
$('.ind_news .swiper-pagination').find('.swiper-pagination-bullet').html('')
}
},
},
breakpoints: {
}
})
}
}