$(function () { new WOW({ offset: 150 }).init(); $('body').running(); new Swiper(".banner .swiper-container", { loop: { delay: 5000 }, autoplay: true, effect: 'fade', pagination: { el: ".banner .swiper-pagination", clickable: true }, navigation: { nextEl: ".banner .swiper-button-next", prevEl: ".banner .swiper-button-prev" } }); var textSwiper = new Swiper('.product-container .text-swiper'); var picSwiper = new Swiper('.product-container .pic-swiper', { navigation: { nextEl: ".product-container .swiper-buttons .next", prevEl: ".product-container .swiper-buttons .prev" }, on: { slideChange: function () { textSwiper.slideTo(this.activeIndex); $('.pro-nemu li').eq(this.activeIndex).find('a').addClass('active').parent().siblings() .find('a.active').removeClass('active'); } } }); $('.pro-nemu li').hover(function () { var idx = $(this).index(); $(this).addClass('active'); $(this).siblings().removeClass('active'); picSwiper.slideTo(idx); }); new Swiper('.ldgh-container .swiper-container', { slidesPerView: 3, spaceBetween: 50, slidesPerGroup: 3, loop: true, loopFillGroupWithBlank: true, navigation: { nextEl: '.ldgh-container .button-next', prevEl: '.ldgh-container .button-prev' } }); new Swiper('.news-container .swiper-container', { slidesPerView: 3, spaceBetween: 50, slidesPerGroup: 3, loop: true, loopFillGroupWithBlank: true, navigation: { nextEl: '.news-container .button-next', prevEl: '.news-container .button-prev' } }); var oul = $('.cus-list ul'); var oulHtml = oul.html(); oul.html(oulHtml + oulHtml); var timeId = null; var ali = $('.cus-list ul li'); // var aliWidth = ali.eq(0).width(); var aliWidth = 200; var aliSize = ali.size(); var ulWidth = aliWidth * aliSize; oul.width(ulWidth); var speed = -2; function slider() { if (speed < 0) { if (oul.css('left') == -ulWidth / 2 + 'px') { oul.css('left', 0); } oul.css('left', '+=-2px'); } if (speed > 0) { if (oul.css('left') == '0px') { oul.css('left', -ulWidth / 2 + 'px'); } oul.css('left', '+=' + speed + 'px'); } } timeId = setInterval(slider, 30); $('.cus-list').mouseover(function () { clearInterval(timeId); }); $('.cus-list').mouseout(function () { timeId = setInterval(slider, 20); }); }); function gotoTop(acceleration, stime) { acceleration = acceleration || 0.1; stime = stime || 10; var x1 = 0; var y1 = 0; var x2 = 0; var y2 = 0; var x3 = 0; var y3 = 0; if (document.documentElement) { x1 = document.documentElement.scrollLeft || 0; y1 = document.documentElement.scrollTop || 0; } if (document.body) { x2 = document.body.scrollLeft || 0; y2 = document.body.scrollTop || 0; } var x3 = window.scrollX || 0; var y3 = window.scrollY || 0; var x = Math.max(x1, Math.max(x2, x3)); var y = Math.max(y1, Math.max(y2, y3)); var speeding = 1 + acceleration; window.scrollTo(Math.floor(x / speeding), Math.floor(y / speeding)); if (x > 0 || y > 0) { var run = "gotoTop(" + acceleration + ", " + stime + ")"; window.setTimeout(run, stime); } }