$(function(){ var swiperBanner = new Swiper('.szgl-banner-swiper', { loop: true, effect: 'fade', navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev' }, pagination: { el: '.swiper-pagination', clickable: true } });//banner $(".szgl-sqsl").slide({ titCell: ".sqsl-hd li", mainCell: ".sqsl-bd" });//甯傛儏甯傚姏 $("#szyxCarousel").owlCarousel({ items: 1, margin: 10, loop: true, autoplay: false, smartSpeed: 800, autoplayTimeout: 5000, autoplayHoverPause: true, autoHeight: true, nav: false });//鑻忓窞鍗拌薄 $("#spxcCarousel").owlCarousel({ items: 1, loop: true, autoplay: true, smartSpeed: 800, autoplayTimeout: 5000, autoplayHoverPause: true, autoHeight: true, nav: false });//瑙嗛瀹d紶 var lnglCarousel = $("#lnglCarousel"); lnglCarousel.owlCarousel({ loop: true, margin: 0, autoplay: false, autoplayHoverPause: true, autoHeight: true, nav: true, navElement: "div", navText:['',''], responsive: { 0: { items: 2 }, 415: { items: 3 }, 769: { items: 4 }, 993: { items: 5 }, 1281: { items: 6 } } }); checklngl(); lnglCarousel.on("translated.owl.carousel", function(event) { checklngl(); }); lnglCarousel.on("change.owl.carousel", function(event) { $(".szgl-lngl .owl-stage .owl-item").removeClass("first-active-item last-active-item"); }); function checklngl(){ var total = $(".szgl-lngl .owl-stage .owl-item.active").length; $(".szgl-lngl .owl-stage .owl-item.active").each(function(index){ if (index === 0) { // this is the first one $(this).addClass("first-active-item"); } if (index === total - 1 && total>1) { // this is the last one $(this).addClass("last-active-item"); } }); }//鍘嗗勾姒傝 var yhcsCarousel = $("#yhcsCarousel"); yhcsCarousel.owlCarousel({ items: 4, margin: 40, center: true, loop: true, autoplay: false, smartSpeed: 800, autoplayTimeout: 5000, autoplayHoverPause: true, autoHeight: true, nav: true, navElement: "div", navText:['',''], responsive: { 0: { items: 1, margin: 0 }, 415: { items: 2, margin: 15 }, 993: { items: 3, margin: 20 }, 1201: { items: 4, margin: 30 }, 1481: { items: 4, margin: 40 } }, }); checkyhcs(); yhcsCarousel.on("translated.owl.carousel", function(event) { checkyhcs(); }); yhcsCarousel.on("change.owl.carousel", function(event) { $(".szgl-yhcs .owl-stage .owl-item").removeClass("last-active-item"); }); function checkyhcs(){ var total = $(".szgl-yhcs .owl-stage .owl-item.active").length; $(".szgl-yhcs .owl-stage .owl-item.active").each(function(index){ if (index === total - 1 && total>1) { // this is the last one $(this).addClass("last-active-item"); } }); }//鍙嬪ソ鍩庡競 }); $(window).load(function () { $(".niceScroll").mCustomScrollbar({ theme: "minimal" }); });