$(function () { var win = $(window), winW = win.width(), ipadV = 992, wap = 640; var main = { exclusive: function (dom) { //排他 dom.addClass("active").siblings().removeClass("active"); }, }; var pointsOfView = $(".points-of-view"), liActive = $(".points-of-view .li.active"), swiperLength = $(".points-of-view .li").length; if (pointsOfView.length) { var timer; var swiper1 = new Swiper(".featured .points-of-view", { pagination: { el: ' .swiper-pagination', clickable: true, }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, // speed: 200, // slidesPerGroup: 1, loop: swiperLength > 1 ? true : false, // 设置自动轮播 loopPreventsSlide: true, //默认true,阻止 // noSwiping: swiperLength > 1 ? false : true, noSwiping: winW > ipadV ? true : false, // loopedSlides: Math.ceil(swiperLength / 2) + 1, // slidesPerGroupSkip: swiperLength, runCallbacksOnInit: true, watchSlidesProgress: true, watchSlidesVisibility: true, // slideToClickedSlide: true, centeredSlides: true, centeredSlidesBounds: true, updateOnWindowResize: true, // freeMode: true, // slide 是否贴合侧边 roundLengths: true, //防止文字模糊 // virtual: true, // autoplay: { // delay: 5000, // pauseOnMouseEnter: true, // }, setWrapperSize: true, preventInteractionOnTransition: true, swipeHandler: '.swiper-wrapper', // slidesPerView: 6, // spaceBetween: 30, breakpoints: { 320: { //当屏幕宽度大于等于320 slidesPerView: 1, spaceBetween: 15 }, 768: { //当屏幕宽度大于等于768 slidesPerView: 1, spaceBetween: 30 }, 992: { //当屏幕宽度大于等于1280 slidesPerView: 6, spaceBetween: 30 } }, on: { init: function () { console.log("init") setTimeout(function () { if ($('.points-of-view .lazyload img').length > 0) { var lazyLazy = new LazyLoad({ elements_selector: ".points-of-view img", data_src: "original", callback_loaded: function (obj) {}, callback_enter: function (obj) {} }); } }, 300) }, slideChangeTransitionStart: function () { var that = this; clearTimeout(timer); timer = setTimeout(function () { if (winW > ipadV) { console.log("slideChangeTransitionStart") var _html = $(that.slides.eq(that.activeIndex).find(".box")).clone(true) // if (_html.hasClass("video")) { // _html.addClass("vedioplay"); // var img = _html.find(".J-ebg-replace-img-lazyload"); // img.attr({ // "data-pc-l": img.data("active"), // "data-original": img.data("active"), // "src": img.data("active") // }) // } liActive.html( _html ); } else { // var _html = $(that.slides.eq(that.activeIndex).find(".box")) // if (_html.hasClass("video")) { // _html.addClass("vedioplay"); // } } }, 100) }, }, }) pointsOfView.on("click", ".swiper-slide", function (e) { var $this = $(this); var index = $this.data("swiper-slide-index"); var isNext = $this.hasClass("swiper-slide-next"); if (isNext) { swiper1.slideNext(); } var isNext2 = $this.prev().hasClass("swiper-slide-next"); if (isNext2) { swiper1.slideNext(0); swiper1.slideNext(); } var isNext3 = $this.prev().prev().hasClass("swiper-slide-next"); if (isNext3) { swiper1.slideNext(0); swiper1.slideNext(0); swiper1.slideNext(); } }) } var sixTab = $(".six-tab"); var thumbsslider = $(".six-tab .thumbsslider"), swiperBox = $(".six-tab .swiper-box"); if (thumbsslider.length && swiperBox.length) { var Swiper2 = new Swiper(".six-tab .swiper-box", { noSwiping: winW > ipadV ? true : false, on: { slideChangeTransitionStart: function () { main.exclusive(thumbsslider.find(".li").eq(this.activeIndex)); } } }) thumbsslider.on("click", ".li", function () { var $this = $(this); main.exclusive($this); Swiper2.slideTo($this.index()) }) if (winW > ipadV) {} else { // var Swiper1 = new Swiper(".six-tab .thumbsslider .swiper-container", { // navigation: { // nextEl: '.swiper-button-next', // prevEl: '.swiper-button-prev', // }, // width: 'auto', // slideToClickedSlide: true, // }) } } var winw = $(window).width(); var wap = 1200; function createVideo() { if (winw > wap) { var video = $('.J-video'); video.each(function (i, v) { var videoUrl = $(this).attr('data-video'); if (videoUrl) { var videoHtml = $(''); videoHtml.attr('src', videoUrl); videoHtml.appendTo(this); } }) } } createVideo(); // 自适应 var resizeTimer = null; $(window).off('resize.banner').on('resize.banner', function () { var curWin_w = $(window).width(); if (winw != curWin_w) { clearTimeout(resizeTimer) resizeTimer = setTimeout(function () { createVideo(); winw = curWin_w; }, 100); }; }) // baseLib.v3SetHeight(".six-tab .swiper-slide", ".ebg-row", ".title", 768) }); $(function () { var wap = 992; var mySwiper = undefined; function isWap() { if ($(window).width() <= wap) { if (!mySwiper || mySwiper.destroyed) { mySwiper = new Swiper(".wellbeing .listBox", { loop: true, pagination: { // 设置点点点 el: '.swiper-pagination', }, slidesPerView: 1.2, roundLengths: true, effect: 'coverflow', //3d滑动 centeredSlides: true, coverflowEffect: { rotate: 0, stretch: 0, depth: 200, modifier: 1, slideShadows: true }, updateOnWindowResize: true, }) } } else { if (mySwiper) { mySwiper.destroy(true) } } } isWap(); $(window).resize(isWap) });