$(window).on( "load", function() { AOS.init(); var sit_swiper = new Swiper(".situation_swiper", { slidesPerView: 1.33, spaceBetween: 20, loop: false, pagination: { el: ".swiper-pagination", clickable: true, }, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, breakpoints: { 768: { slidesPerView: 2, } } }); var sit_swiper_b = new Swiper(".situation_swiper_b", { slidesPerView: 1.33, spaceBetween: 20, loop: false, pagination: { el: ".swiper-pagination", clickable: true, }, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, breakpoints: { 768: { slidesPerView: 3, } } }); $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { AOS.refresh(); setTimeout(function(){ sit_swiper.update(); sit_swiper_b.update(); $(".cod_height").each(function() { var maxHeight = Math.max.apply(null, $(".cod_height").map(function() { return $(this).height(); }).get()); $(".cod_height").height(maxHeight); }); }, 500); }); $(window).resize(function() { setTimeout(function(){ sit_swiper.update(); sit_swiper_b.update(); $(".cod_height").each(function() { var maxHeight = Math.max.apply(null, $(".cod_height").map(function() { return $(this).height(); }).get()); $(".cod_height").height(maxHeight); }); }, 500); }); $('.tab_bar a').click(function() { $('.tab_bar a').removeClass('onnn'); $(this).addClass('onnn'); }); $('.remarks.trig').on('click', function () { $(this).toggleClass('off'); $(this).next('.remarksEXT').find('.remarks').slideToggle(); }); // Scroll spy functionality $(window).scroll(function() { var scrollDistance = $(window).scrollTop(); var windowHeight = $(window).height(); var threshold = windowHeight / 3; $('.spy_point').each(function(i) { var elementTop = $(this).offset().top; if (elementTop <= scrollDistance + threshold && elementTop + $(this).height() > scrollDistance) { $('.option_bar select').val(i); return false; } }); }); // Handle select change $('.option_bar select').change(function() { var targetSection = $('.spy_point').eq($(this).val()); switch($(this).val()){ case '2': case '3': case '4': $('#tab_sdfr').click(); break; case '5': case '6': case '7': $('#tab_sdir').click(); break; default: break; } setTimeout(function(){ $('html, body').animate({ scrollTop: targetSection.offset().top - 100 }, 500); }, 500); }); });