$(function(){ navswiper() swiper1() swiper2() honor() $('.detalis1 .swiper-slide p').mCustomScrollbar({ autoDraggerLength: true, scrollInertia: 300, advanced: { autoScrollOnFocus: "" }, scrollButtons: { scrollAmount: 10 } }); $('.topnav ul li a').click(function () { console.log('2') $(this).parents("li").addClass("on").siblings("li").removeClass("on") var target = $(this).attr('href'); if($(window).width()>1024){ $('html, body').animate({ scrollTop: $(target).offset().top - 230 //110可以根据你自己的情况设置 }, 500); return false; }else{ $('html, body').animate({ scrollTop: $(target).offset().top - 200 //110可以根据你自己的情况设置 }, 500); return false; } }); window.onload = function () { var pos = $('.topnav').offset();// offset() 获得div1当前的位置,左上角坐标(x,y) $(window).scroll(function () { //滚动条滚动事件 if ($(this).scrollTop() > pos.top ) { if($(window).width()>1024){ $('.topnav').css('top', 75).css('position', 'fixed').css('width', '100%').css('z-index','999'); }else{ $('.topnav').css('top', 50).css('position', 'fixed').css('width', '100%').css('z-index','999'); } } else if ($(this).scrollTop() <= pos.top ) { $('.topnav').css('top',0).css('position', 'relative').css('z-index','1'); } }) }; var urlTxt=(getParam("name")) if(urlTxt){ if($(window).width()>1024){ $('html, body').animate({ scrollTop: $("#" + urlTxt).offset().top - 230 //110可以根据你自己的情况设置 }, 500); return false; }else{ $('html, body').animate({ scrollTop: $("#" + urlTxt).offset().top - 200 //110可以根据你自己的情况设置 }, 500); return false; } } ScollText(".detalis3 .videowrap .right>p"); var delswiper = [] for (var i = 0; i < $('.detalis3').length; i++) { delswiper[i] = new Swiper( $('.detalis3') .eq(i) .find('.swiper-container') .get(0), { pagination: $('.detalis3') .eq(i) .find('.swiper-pagination') .get(0), // paginationClickable: true, slidesPerView: 1, slidesPerGroup: 1, spaceBetween: 0, nextButton: $('.detalis3') .eq(i) .find('.swiper-button-next') .get(0), prevButton: $('.detalis3') .eq(i) .find('.swiper-button-prev') .get(0), paginationClickable: true, // loop:true, } ) } if($(".detalis3 .swiper-slide").length>1){ $(".detalis3 .swiper-pagination").show() }else{ $(".detalis3 .swiper-pagination").hide() } }) var navswiper = function(){ if($(window).width() <= 768){ if($('.topnav ul .swiper-slide').length<=2){ $('.lhl_but').hide() } }else{ if($('.topnav ul .swiper-slide').length<=6){ $('.lhl_but').hide() } } if($('.topnav ul .swiper-slide').length > 6){ $('.topnav ul').removeClass('ul') var swiper = new Swiper('.topnav .swiper-container', { slidesPerView: 6, paginationClickable: true, spaceBetween: 0, nextButton: '.topnav .swiper-button-next', prevButton: '.topnav .swiper-button-prev', }); } if($(window).width() <= 768){ console.log('1') $('.topnav ul').removeClass('ul') var swiper = new Swiper('.topnav .swiper-container', { pagination: '.swiper-pagination', slidesPerView: 2, paginationClickable: true, spaceBetween: 0, nextButton: '.topnav .swiper-button-next', prevButton: '.topnav .swiper-button-prev', }); } } var swiper1 = function(){ var swiper1 = new Swiper('.detalis1 .swiper-container', { nextButton: '.detalis1 .swiper-button-next', prevButton: '.detalis1 .swiper-button-prev', spaceBetween: 40, slidesPerView: 3, breakpoints: { 1023: { slidesPerView: 3, }, 767: { slidesPerView: 1, } }, }); } var swiper2 = function(){ var swiper2 = new Swiper('.detalis2 .swiper-container', { spaceBetween: 40, slidesPerView: 3, pagination: '.detalis2 .swiper-pagination', paginationClickable: '.detalis2 .swiper-pagination', breakpoints: { 1023: { slidesPerView: 3, }, 767: { slidesPerView: 1, } }, }); } setTimeout(function () { // if($(".detalis3 .swiper-slide").length>1){ // $(".detalis3 .swiper-pagination").show() // }else{ // $(".detalis3 .swiper-pagination").hide() // } // console.log($(".detalis3 .swiper-slide").length) // var swiper33 = function(){ // // var swiper3 = new Swiper('.detalis3 .swiper-container', { // spaceBetween: 0, // slidesPerView: 1, // pagination: '.detalis3 .swiper-pagination', // paginationClickable: '.detalis3 .swiper-pagination', // }); // } },2000) function honor(){ $(".honor-tit li").eq(0).addClass("on"); $(".honor-con .tab-c").eq(0).addClass("on") $(document).on('click','.honor-tit li',function(){ var _ind = $(this).index(); $(this).addClass("on").siblings().removeClass("on"); $(".honor-con .tab-c").eq(_ind).addClass("on").siblings().removeClass("on"); }) //历史荣誉 var viewSwiper = new Swiper('.view01 .swiper-container', { loop:false, nextButton: '.preview01 .swiper-button-next', prevButton: '.preview01 .swiper-button-prev', onSlideChangeStart: function() { updateNavPosition() } }) var previewSwiper = new Swiper('.preview01 .swiper-container', { slidesPerView: 5, spaceBetween: 10, allowTouchMove: false, onTap: function() { viewSwiper.slideTo(previewSwiper.clickedIndex) } }) function updateNavPosition() { $('.preview01 .active-nav').removeClass('active-nav') var activeNav = $('.preview01 .swiper-slide').eq(viewSwiper.activeIndex).addClass('active-nav') if (!activeNav.hasClass('swiper-slide-visible')) { if (activeNav.index() > previewSwiper.activeIndex) { var thumbsPerNav = Math.floor(previewSwiper.width / activeNav.width()) - 1 previewSwiper.slideTo(activeNav.index() - thumbsPerNav) } else { previewSwiper.slideTo(activeNav.index()) } } } //获奖证书 var viewSwiper02 = new Swiper('.view02 .swiper-container', { loop:false, nextButton: '.view02 .swiper-button-next', prevButton: '.view02 .swiper-button-prev', onSlideChangeStart: function() { updateNavPosition02() } }) var previewSwiper02 = new Swiper('.preview02 .swiper-container', { slidesPerView: 5, spaceBetween: 10, allowTouchMove: false, onTap: function() { viewSwiper02.slideTo(previewSwiper02.clickedIndex) } }) function updateNavPosition02() { $('.preview02 .active-nav').removeClass('active-nav') var activeNav02 = $('.preview02 .swiper-slide').eq(viewSwiper02.activeIndex).addClass('active-nav') if (!activeNav02.hasClass('swiper-slide-visible')) { if (activeNav02.index() > previewSwiper02.activeIndex) { var thumbsPerNav02 = Math.floor(previewSwiper02.width / activeNav02.width()) - 1 previewSwiper02.slideTo(activeNav02.index() - thumbsPerNav02) } else { previewSwiper02.slideTo(activeNav02.index()) } } } } function getParam(paramName) { paramValue = "", isFound = !1; if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) { arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0; while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++ } return paramValue == "" && (paramValue = null), paramValue }