/******** home.js start ******/ $(function() { var tap = 'ontouchstart' in document ? 'touchend' : 'click'; // pc端轮播 var banwebswip = new swiper('.home-banweb', { loop: true, speed: 1500, watchoverflow: true, pagination:{ el: '.hmweb-paging', bulletclass : 'bullet', bulletactiveclass: 'active', clickable: true }, autoplay: { delay: 5000, stoponlastslide: false, disableoninteraction: true, }, observer: true, observeparents: true, on: { init: function(){ var activeindex = this.activeindex; $(this.slides[activeindex]).addclass('is-active_after').siblings().removeclass('is-active_after'); }, transitionend: function(){ var activeindex = this.activeindex; $(this.slides[activeindex]).addclass('is-active_after').siblings().removeclass('is-active_after'); } } }); $('.hmweb-pause').on('click', function(){ banwebswip.autoplay.stop(); $(this).hide(); $('.hmweb-play').show(); }); $('.hmweb-play').on('click', function(){ var activeindex = (banwebswip.activeindex == banwebswip.slides.length-1) ? 0 : banwebswip.activeindex+1; banwebswip.slideto(activeindex, 1000, false); banwebswip.autoplay.start(); $(this).hide(); $('.hmweb-pause').show(); }); if(banwebswip.slides.length <= 3){ banwebswip.destroy(); $('.hmweb-ctrl, .hmweb-pause, .hmweb-play').hide(); } // 移动端轮播 var banappswip = new swiper('.home-banapp', { loop: true, speed: 1000, watchoverflow: true, pagination:{ el: '.hmapp-paging', bulletclass : 'bullet', bulletactiveclass: 'active', clickable: true }, autoplay: { delay: 5000, stoponlastslide: false, disableoninteraction: true, }, observer: true, observeparents: true, on: { init: function(){ $(this.slides[0]).addclass('is-active_after').siblings().removeclass('is-active_after'); }, transitionend: function(){ var activeindex = this.activeindex; $(this.slides[activeindex]).addclass('is-active_after').siblings().removeclass('is-active_after'); } } }); $('.hmapp-pause').on(tap, function(){ banappswip.autoplay.stop(); $(this).hide(); $('.hmapp-play').show(); }); $('.hmapp-play').on(tap, function(){ var activeindex = (banappswip.activeindex == banappswip.slides.length-1) ? 0 : banappswip.activeindex+1; banappswip.slideto(activeindex, 1000, false); banappswip.autoplay.start(); $(this).hide(); $('.hmapp-pause').show(); }); if(banappswip.slides.length <= 3){ banappswip.destroy(); $('.hmapp-ctrl, .hmapp-pause, .hmapp-play').hide(); } // 图片新闻 var photoswip = new swiper('.home-newsphoto', { speed: 500, loop: true, watchoverflow: true, pagination:{ el: '.photo-paging', bulletclass : 'bullet', bulletactiveclass: 'active', clickable: true }, autoplay: { delay: 5000, stoponlastslide: false, disableoninteraction: true, }, observer: true, observeparents: true, on: { init: function(){ var activeindex = this.activeindex; $(this.slides[activeindex]).addclass('is-active_after').siblings().removeclass('is-active_after'); }, transitionend: function(){ var activeindex = this.activeindex; $(this.slides[activeindex]).addclass('is-active_after').siblings().removeclass('is-active_after'); } } }); if(photoswip.slides.length <= 3){ photoswip.destroy(); $('.photo-paging').hide(); } // 公告 $('.hnotice-tablist a').on('mouseenter click', function(){ var $lis = $(this).parent('li'); var id = $(this).attr('data-id'), href = $(this).attr('data-href'); $lis.addclass('active').siblings().removeclass('active'); $('.hnoice-head .more').attr('href', href); $(id).addclass('in').stop(true,true).fadein(300, function() { $(id).addclass('active') .find('.wow').addclass('animated') .css({ 'visibility': 'visible', 'animation-name': 'fadeinup2' }); }).siblings('.hnotice-pane').removeclass('in active').hide(); }); // 快捷链接 var hmlinkswip = new swiper('.hmlink-swip', { slidesperview: 1.05, spacebetween: '6%', observer: true, observeparents: true, breakpoints: { 576: { slidesperview: 1.3, spacebetween: 20, }, 720: { slidesperview: 2.2, spacebetween: 20, }, 992: { slidesperview: 3, spacebetween: 30 }, 1500: { slidesperview: 3, spacebetween: 48, } } }); $(window).on('load', function(){ var winw = parseint($(window).width()); if(winw < 768){ $('.home-newsbox').removeclass('fadeinleft').addclass('wow fadeinup2'); }else{ $('.home-newsphoto').addclass('wow fadeinleft'); $('.home-newsbox').addclass('wow fadeinright'); } if(wow) wow.init(); }); });