$=jquery;
// function openwin(_html,_w,_h){
// var $winbox = $('.win-box');
// var $wincontainer = $winbox.find('.win-container');
// var $wincontent = $winbox.find('.win-content');
// $wincontainer.css({ 'width': _w+'px', 'height': _h+'px', 'margintop': -_h/2+'px', 'marginleft': -_w/2+'px', });
// $wincontent.html(_html);
// $winbox.addclass('win-box-show');
// $('body').css('overflow','hidden');
// }
// $(document)
// .on('click', '.win-bg', function(){
// var $this = $(this);
// var $winbox = $this.parents('.win-box');
// $winbox.removeclass('win-box-show');
// $winbox.find('.win-content').html('');
// $('body').css('overflow','auto');
// })
// .on('click', '.win-box .win-close', function(){
// $('.win-bg').trigger('click');
// });
$(function(){
function body_scroll(){
var scroll = $(window).scrolltop();
if( scroll >= 20 ){
$('body').addclass('is-scroll');
}else{
$('body').removeclass('is-scroll');
}
}
body_scroll();
$(window).scroll(function (event) {
body_scroll();
});
//导航
$('.m-btn, .menu-box').on('click', function(){
$('.fun-header .item').removeclass('cur');
if( $('.menu-box').hasclass('show') ){
$('.menu-box').removeclass('show');
$('body').css('overflow','auto');
}else{
$('.menu-box').addclass('show');
$('body').css('overflow','hidden');
}
return false;
});
$('.fun-header .item-btn').on('click', function(){
$('.menu-box').removeclass('show');
$('body').css('overflow','auto');
var $this_item = $(this).closest('.item');
$this_item.toggleclass('cur');
$this_item.siblings('.item').removeclass('cur');
});
$('body').on('click', function(){
$('.fun-header .item').removeclass('cur');
$('.menu-box').removeclass('show');
$('body').css('overflow','auto');
});
$('.fun-header .item, .menu-box .menu').on('click', function(event){
event.stoppropagation();
});
//单个图片弹出
if ($(".image-popup").length) {
$('.image-popup').magnificpopup({
type: 'image',
closeoncontentclick: true,
mainclass: 'mfp-img-mobile',
image: {
verticalfit: true
}
});
}
//图片组弹出
if ($(".gallery").length) {
$('.gallery').each(function() {
$(this).magnificpopup({
delegate: 'a',
type: 'image',
closeoncontentclick: true,
tloading: 'loading image #%curr%...',
mainclass: 'mfp-img-mobile',
fixedcontentpos: false,
gallery: {
enabled:true,
navigatebyimgclick: true,
}
});
});
}
//视频弹出
if ($(".video-popup").length) {
$(".video-popup").magnificpopup({
type: "iframe",
mainclass: "mfp-fade",
removaldelay: 160,
preloader: true,
fixedcontentpos: false
});
}
if ($(".videos-popup").length) {
$('.videos-popup').each(function() {
$(this).magnificpopup({
delegate: 'a',
type: "iframe",
mainclass: "mfp-fade",
removaldelay: 160,
preloader: true,
fixedcontentpos: false
});
});
}
//iframe页面
// if ($(".web-popup").length) {
// $('.web-popup .item-a').each(function() {
// $(this).magnificpopup({
// type: "iframe",
// mainclass: "mfp-fade web-popup-win",
// removaldelay: 160,
// preloader: true,
// fixedcontentpos: false
// });
// $(this).on('click',function(){
// $('body').css('overflow','hidden');
// return false;
// });
// });
// $(document).on('click', '.mfp-close', function (e) {
// $('body').css('overflow','auto');
// });
// }
if ($(".list-job").length) {
$('.list-job .a-btn').on('click',function() {
var $this = $(this);
var $showbox = $this.closest('.tr01').next('.tr02');
$showbox.removeclass('d-none').siblings('.tr02').addclass('d-none');
});
}
var _aboutdata = 0;
$(window).scroll(function (event) {
if( $('.js-number').length > 0 && _aboutdata == 0){
if( $(document).scrolltop() + $(window).height()/4*3 > $('.js-number').offset().top ){
var scroll1 = new countup("number01", 0, 4, 0, 1);
var scroll2 = new countup("number02", 0, 30, 0, 1);
var scroll3 = new countup("number03", 0, 20000, 0, 1);
var scroll4 = new countup("number04", 0, 6000, 0, 1);
scroll1.start();
scroll2.start();
scroll3.start();
scroll4.start();
_aboutdata = 1;
}
}
});
//瑙嗛寮瑰嚭
// $(document).on('click', '.video-win-btn , .play-box', function(){
// var $win_w = $(window).width();
// var $this = $(this);
// var $this_video = $this.data('videourl');
// if( $win_w > 1000 ){ $win_w = 1000; }
// var _html = '';
// openwin(_html,$win_w*0.9,$win_w*0.9*0.7);
// });
$(window).scroll(function() {
if ($(window).scrolltop() > 50) {
$(".goto-top").fadein(200);
} else {
$(".goto-top").fadeout(200);
}
});
$(".goto-top").click(function() {
$('body,html').animate({
scrolltop: 0
},
500);
return false;
});
var imgbox_large_swiper = new swiper('.imgbox-large .swiper-container', {
// autoplay: 3000,
speed: 100,
// autoheight: true,
onslidechangestart: function() {
$('.imgbox-small .active-nav').removeclass('active-nav')
var activenav = $('.imgbox-small .swiper-slide').eq(imgbox_large_swiper.activeindex).addclass('active-nav')
if (!activenav.hasclass('swiper-slide-visible')) {
if (activenav.index() > imgbox_small_swiper.activeindex) {
var thumbspernav = math.floor(imgbox_small_swiper.width / activenav.width()) - 1
imgbox_small_swiper.slideto(activenav.index() - thumbspernav)
} else {
imgbox_small_swiper.slideto(activenav.index())
}
}
}
})
$('.imgbox-large .arrow-left, .imgbox-small .arrow-left').on('click', function(e) {
e.preventdefault()
if (imgbox_large_swiper.activeindex == 0) {
imgbox_large_swiper.slideto(imgbox_large_swiper.slides.length - 1, 1000);
return
}
imgbox_large_swiper.slideprev()
})
$('.imgbox-large .arrow-right, .imgbox-small .arrow-right').on('click', function(e) {
e.preventdefault()
if (imgbox_large_swiper.activeindex == imgbox_large_swiper.slides.length - 1) {
imgbox_large_swiper.slideto(0, 1000);
return
}
imgbox_large_swiper.slidenext()
})
var imgbox_small_swiper = new swiper('.imgbox-small .swiper-container', {
speed: 200,
// slidesperview: 'auto',
allowtouchmove: false,
slidesperview: 5,
spacebetween: 4,
simulatetouch : false,
// ontap: function() {
// imgbox_large_swiper.slideto(imgbox_small_swiper.clickedindex);
// }
});
$('.imgbox-small .swiper-slide').on('click', function() {
var _index = $(this).index();
imgbox_large_swiper.slideto(_index);
});
});