$(function() { function getquerystring(name) { var reg = new regexp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); var r = window.location.search.substr(1).match(reg); if (r != null) { return unescape(r[2]); } return null; } var name = getquerystring("name"); var h = $('.header').height(); if (name) { var scrolltarget = '#' + name; settimeout(function() { $("html,body").animate({ scrolltop: $(scrolltarget).offset().top - h }, 200); }, 10); } $('.sub-nav .con .left').on('click', 'li', function() { var scrolltarget = '#' + $(this).attr('data-name'); $("html,body").animate({ scrolltop: $(scrolltarget).offset().top - h }, 200); }); var swiper = new swiper(".ctn2 .swiper-container", { autoplay: { delay: 5000, stoponlastslide: false, disableoninteraction: false, }, slidesperview: 3, slidespercolumn: 2, slidespercolumnfill: 'row', spacebetween: 40, navigation: { nextel: '.ctn2 .swiper-button-next', prevel: '.ctn2 .swiper-button-prev', }, pagination: { el: '.ctn2 .swiper-pagination', clickable: true, }, breakpoints: { 768: { //当屏幕宽度大于等于768 slidesperview: 1, slidespercolumn: 1, }, 1200: { spacebetween: 20, } } }); $('.ctn3 .con .c-list .left ul li:first-child').addclass('active'); $('.ctn3 .con .c-list .right .r-box:first-child').addclass('active'); $(".scroll-1").mcustomscrollbar(); $('.ctn3 .con .c-list .left ul li').click(function() { var index = $(this).index(); $(this).addclass('active').siblings().removeclass('active'); $('.ctn3 .con .c-list .right .r-box').eq(index).addclass('active').siblings().removeclass('active'); $(".scroll-1").mcustomscrollbar(); }); })