(function ($) { $(function () { var hiscount=0; var gethissize=$(".dev_index_l_box li").size(); $(".dev_index_r ul").each(function (i) { // togglemasonry(i); }) $(window).resize(function (){ if (true) { //phone init start $(".dev_index").addclass("phone_dev"); try{ var myswiper2 = new swiper('#swiper-container2', { watchslidesprogress: true, watchslidesvisibility: true, slidesperview: 7, prevbutton:'.but a.prev', nextbutton:'.but a.next', breakpoints: { //当宽度小于等于320 768: { slidesperview: 3, }, }, ontap: function () { myswiper3.slideto(myswiper2.clickedindex); }, }) var myswiper3 = new swiper('#swiper-container3', { autoheight: true, // oninit: function(swiper){ // $("#swiper-container3 .swiper-wrapper").css("height","auto") // }, onslidechangestart: function () { updatenavposition(); } }) function updatenavposition() { $('#swiper-container2 .active-nav').removeclass('active-nav') var activenav = $('#swiper-container2 .swiper-slide').eq(myswiper3.activeindex).addclass('active-nav'); if (!activenav.hasclass('swiper-slide-visible')) { if (activenav.index() > myswiper2.activeindex) { var thumbspernav = math.floor(myswiper2.width / activenav.width()) - 1 myswiper2.slideto(activenav.index() - thumbspernav) } else { myswiper2.slideto(activenav.index()) } } } } catch (e) { } } }) $(window).resize(); $(".dev_index_l_top").click(function(){ if(hiscount<=1){ $(".dev_index_l_top").addclass("disabled"); }else{ $(".dev_index_l_top").removeclass("disabled"); $(".dev_index_l_bottom").removeclass("disabled"); } if(hiscount<=0){ }else{ hiscount--; if ($(window).width()<1024) { //phone } else { $("body,html").stop().animate({ scrolltop: $(".dev_index_r_box > .dev_index_r_part:eq(" + hiscount + ")").offset().top-108 }, 600); devgetposition(hiscount); } } }) $(".dev_index_l_bottom").click(function(){ if(hiscount>=gethissize-2){ $(".dev_index_l_bottom").addclass("disabled"); }else{ $(".dev_index_l_top").removeclass("disabled"); $(".dev_index_l_bottom").removeclass("disabled"); } if(hiscount>=gethissize-1){ }else{ hiscount++; if ($(window).width()<1024) { //phone } else { $("body,html").stop().animate({ scrolltop: $(".dev_index_r_box > .dev_index_r_part:eq(" + hiscount + ")").offset().top-108 }, 600); devgetposition(hiscount); } } }) function devgetposition(nindex) { var getleftliheight = $(".dev_index_l_wrap li:eq(0)").height(); var getsize = $(".dev_index_l_wrap li span").size(); if (nindex > 1 && nindex < getsize - 3) { $(".dev_index_l_box ul").stop().animate({ "top": nindex * getleftliheight * -1 + getleftliheight * 2 }); } else if (nindex >= getsize - 3) { $(".dev_index_l_box ul").stop().animate({ "top": getleftliheight * getsize * -1 + getleftliheight * 5 }); } else if (nindex <= 1) { $(".dev_index_l_box ul").stop().animate({ "top": 0 }); } if(nindex>=gethissize-1){ $(".dev_index_l_bottom").addclass("disabled"); }else if(nindex<=0){ $(".dev_index_l_top").addclass("disabled"); }else{ $(".dev_index_l_top").removeclass("disabled"); $(".dev_index_l_bottom").removeclass("disabled"); } } function devfunction() { $(".dev_index_l_wrap li span").click(function () { var nindex = $(".dev_index_l_wrap li span").index(this); if ($(window).width()<1024) { //phone //$(".dev_index_l_box li:eq(" + nindex + ")").addclass("active").siblings().removeclass("active"); //$("body,html").stop().animate({ scrolltop: $(".dev_index_r > .dev_index_r_part:eq(" + nindex + ")").offset().top - 120 }, 600); //myswiper.slideto(nindex, 1000, false); } else { $("body,html").stop().animate({ scrolltop: $(".dev_index_r_box > .dev_index_r_part:eq(" + nindex + ")").offset().top-108 }, 600); devgetposition(nindex); hiscount=nindex; } if(nindex>=gethissize-1){ $(".dev_index_l_bottom").addclass("disabled"); }else if(nindex<=0){ $(".dev_index_l_top").addclass("disabled"); }else{ $(".dev_index_l_top").removeclass("disabled"); $(".dev_index_l_bottom").removeclass("disabled"); } }) $(window).scroll(function () { if ($(window).width()<1024) { //phone scroll start if ($(window).scrolltop() > $(".dev_index").offset().top) { //$(".phone_dev").addclass("dev_fixed"); } else { //$(".phone_dev").removeclass("dev_fixed"); } //phone scroll end } else { //pc scroll start if ($(window).scrolltop() > $(".dev_index_r").offset().top) { var getleftposition = $(window).scrolltop() - $(".dev_index_r").offset().top + 20; var getcompareposition = $(".dev_index_r").height() - $(".dev_index_l").height(); if (getleftposition >= getcompareposition) { //$(".dev_index_l").css({ "opacity": 1, "left": $(".dev_index").offset().left, "top": $(".dev_index_r").offset().top }); $(".dev_index_l").css({ "top": getcompareposition - 40, "position": "absolute","left":0 }); } else { $(".dev_index_l").css({ "opacity": 1, "left": $(".dev_index").offset().left, "top": 138,"position":"fixed" }); } } else { $(".dev_index_l").css({ "opacity": 1, "top": 0, "position": "absolute", "left": 0 }); } //pc scroll end } try { $(".dev_index_r h4").each(function (i) { if ($(window).width()<1024) { if ($(window).scrolltop() >= $(".dev_index_r_box > .dev_index_r_part:eq(" + i + ")").offset().top - 120) { } else { } } else { if ($(window).scrolltop() >= $(".dev_index_r_box > .dev_index_r_part:eq(" + i + ")").offset().top-20-300) { //pc $(".dev_index_l_box li:eq(" + i + ")").addclass("active").siblings().removeclass("active"); devgetposition(i); hiscount=i; } else { } } }) } catch (e) { } }) } function togglemasonry(i) { $('#u' + i).imagesloaded(function () { $('#u' + i).masonry({ itemselector: 'li' }); $(".dev_index_r li").each(function () { try { if ($(this).position().left != 0) { $(this).addclass("odd"); } } catch (e) { } }) devfunction(); $(window).scroll(); }) } }) })(jquery); $(function(){ downbutint(); }) function downbutint(){ $('#slide_down').on('click',function(){ var _height=$('.video-banner').outerheight(true); $('html,body').animate({scrolltop: _height}, 700); }) }