;(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 ($(window).width() < 1024) { //phone init start $('.dev_index').addClass('phone_dev') try { var mySwiper2 = new Swiper('#swiper-container2', { watchSlidesProgress: true, watchSlidesVisibility: true, slidesPerView: 5, //prevButton:'#swiper-container2 .swiper-button-prev', //nextButton:'#swiper-container2 .swiper-button-next', onTap: function () { mySwiper3.slideTo(mySwiper2.clickedIndex) }, }) // var mySwiper3 = new Swiper('#swiper-container3', { // autoHeight: true, // onInit: function(swiper){ // }, // 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) {} //phone init end } else { //pc init start $('.dev_index').removeClass('phone_dev') try { if ($(window).scrollTop() > $('.dev_index_r').offset().top) { var getLeftPosition2 = $(window).scrollTop() - $('.dev_index_r').offset().top + 20 var getComparePosition2 = $('.dev_index_r').height() - $('.dev_index_l').height() if (getLeftPosition2 >= getComparePosition2) { $('.dev_index_l').css({ top: getComparePosition2 - 40, position: 'absolute', right: 0, }) } else { $('.dev_index_l').css({ opacity: 1, right: $('.dev_index').offset().left, top: 98, position: 'fixed', }) } } else { $('.dev_index_l').css({ opacity: 1, top: 0, position: 'absolute', right: 0, }) } } catch (e) {} //pc init end } }) $(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 - 68, }, 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 - 68, }, 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 - 7) { $('.dev_index_l_box ul') .stop() .animate({ top: nIndex * getLeftLiHeight * -1 + getLeftLiHeight * 2 }) } else if (nIndex >= getSize - 7) { $('.dev_index_l_box ul') .stop() .animate({ top: getLeftLiHeight * getSize * -1 + getLeftLiHeight * 9, }) } 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 } else { $('body,html') .stop() .animate( { scrollTop: $( '.dev_index_r_box > .dev_index_r_part:eq(' + nIndex + ')' ).offset().top - 68, }, 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({ top: getComparePosition - 40, position: 'absolute', right: 0, }) } else { $('.dev_index_l').css({ opacity: 1, right: $('.dev_index').offset().left, top: 98, position: 'fixed', }) } } else { $('.dev_index_l').css({ opacity: 1, top: 0, position: 'absolute', right: 0, }) } //pc scroll end } try { $('.dev_index_r dl dt').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 - 200 ) { //pc $('.dev_index_l_box li:eq(' + i + ')') .addClass('active') .siblings() .removeClass('active') $('.dev_index_r_box > .dev_index_r_part: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)