; /* Start:"a:4:{s:4:"full";s:39:"/webfiles/js/products.js?16512577504403";s:6:"source";s:24:"/webfiles/js/products.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ $(document).ready(function(){ var innerMenu = new Swiper('.products_tabs .swiper-container', { slidesPerView: 'auto', direction: 'vertical', speed: 500, resistanceRatio: 0, breakpoints: { // when window width is <= 767px 767: { direction: 'horizontal', } } }); var menu_waypoint = new Waypoint.Sticky({ element: $('.products_tabs')[0], handler: function(direction){ innerMenu.update(); } }); menuFix(); function getSlideIndexByClass(className) { var index = 0; $.each($('.products_tabs__item'), function(i, item) { if ($(item).hasClass(className)) { index = i; return false; } }); return index; } function menuNav(item_id) { $('.products_tabs__item').removeClass('selected'); $('.products_tabs__item[data-link="'+ item_id +'"]').addClass('selected'); } $('.product_section').each(function(index) { var $current_section = $(this); var current_id = $current_section.attr('id'); $current_section.waypoint(function(direction) { if (direction === 'down'){ menuNav(current_id); innerMenu.slideTo(getSlideIndexByClass('selected')); } }, { offset: '60%' }); $current_section.waypoint(function(direction) { if (direction === 'up'){ menuNav(current_id); innerMenu.slideTo(getSlideIndexByClass('selected')); } }, { offset: function() { return window.innerHeight*0.6 - this.element.clientHeight; } }); }); $('.products_tabs__item').click(function(){ //var menu_height = $('.products_tabs').height(); var link_to = $(this).attr('data-link'); $('html, body').animate({ //scrollTop: $('#'+link_to).offset().top - menu_height scrollTop: $('#'+link_to).offset().top - 84 }, 750); }); var qualitySlider = new Swiper('.quality .swiper-container', { loop: true, speed: 500, slidesPerView: 1, resistanceRatio: 0, effect: 'fade', fadeEffect: { crossFade: true }, navigation: { nextEl: '.quality .swiper-button-next', prevEl: '.quality .swiper-button-prev', }, pagination: { el: '.quality .swiper-pagination', clickable: false, type: 'custom', renderCustom: function (swiper, current, total) { return '' + current.toString().padStart(2,0) + '' + '' + '' + total.toString().padStart(2,0) + ''; } }, }); // на странице /products/ при нажатии на Показать все бренды обновляется Waypoint function fixProductsMenuOnReload() { var moreBtn = document.querySelector('.button.more-brands'); if (!moreBtn) { return; } moreBtn.addEventListener('click', function () { setTimeout(function () { Waypoint.refreshAll() }, 1) }); } fixProductsMenuOnReload(); }); function menuFix(){ if( $('.products_tabs').height() >= ($('.productsPage').height() + $('.productsPage').offset().top - $(window).scrollTop()) ){ $('.products_tabs').addClass('position-bottom'); } else { $('.products_tabs').removeClass('position-bottom'); } } $(window).on('scroll orientationchange', menuFix); var lastScrollTop = 0; $(window).on('scroll', function() { st = $(this).scrollTop(); if(st < lastScrollTop) { // up $('.products_tabs').removeClass('animation-in').addClass('animation-out'); } else { // down $('.products_tabs').addClass('animation-in').removeClass('animation-out'); } lastScrollTop = st; }); /* End */ ;; /* /webfiles/js/products.js?16512577504403*/