$(document).ready(function(){ footer(); socialBlock(); footerHover(); headerPhones(); firstMenuHover(); openMobMenu(); closeMobMenu(); callMobile(); menuCatalog(); addOverlayMenu(); citySelectHome(); sizeTable(); descriptionCard(); formComments(); function footer(){ footerBottom(); resizeFooterBottom(); function footerBottom(){ var heightHeader = $('.section-box-header').height() var heightFooter = $('.section-box-footer').height() var windowHeight = $(window).height() $('.section-box-content').css({minHeight:windowHeight-heightHeader-heightFooter}) } function resizeFooterBottom(){ $(window).resize(function(){ footerBottom(); }) } } function mobOverlayAdd() { $('body').append('
') } function mobOverlayRemove() { $('.mob-overlay').remove() } function socialBlock(){ $('ul.blog-social-ico li').click(function(){ $('ul.blog-social-ico li').removeClass('active') $(this).addClass('active') var socialIconIndex = $(this).index()+1; if(socialIconIndex ==1){ $('.blog-social-navi-arrow').css({marginLeft:9}); } else if (socialIconIndex ==2) { $('.blog-social-navi-arrow').css({marginLeft: 53}); } var socialHide = $('.blog-social-hide li'); $('.blog-social-hide li').css({display:'none'}); $(socialHide[socialIconIndex-1]).toggle(200); }) } function footerHover() { $('.menu-list-second-footer li').hover(function () { $('.menu-list-second-footer li').removeClass('active') $(this).addClass('active') }, function () { $('.menu-list-second-footer li').removeClass('active') }) } function headerPhones() { function removeHiddeOperatorPhones() { $('.hidden-phones-h_list').removeClass('active') } $('.phones-h_list').click(function () { $('.hidden-phones-h_list').addClass('active') }) $('.hidden-phones-h_list li').click(function () { var imgPgone = $(this).find('div').clone() var txtPhone = $(this).find('p').html() $('.phones-h-num').empty() $('.phones-h-num').html(txtPhone) removeHiddeOperatorPhones() $('.phones-h_list div:first-child').remove() $('.phones-h_list div').before(imgPgone) $('.hidden-phones-h_list li').removeClass('hidden_') $(this).addClass('hidden_') }) $('.phones-header-wr').hover(function () { }, function () { removeHiddeOperatorPhones() }) $('.callback_h').click(function () { removeHiddeOperatorPhones() }) } function firstMenuHover() { $('.first-menu-wr ul li a').hover(function () { if($(this).find('span').length>0) { $(this).find('span').addClass('active') } else { $(this).addClass('active') } },function () { $(this).find('span').removeClass('active') $(this).removeClass('active') }) } function openMobMenu() { $('.menu_mob').click(function () { mobOverlayAdd() $('body').addClass('off-scroll') $('#menu-mob-hidden').addClass('open') setTimeout(function () { $('#menu-mob-hidden').addClass('visible') },10) }) } function closeCallMobileHide() { $('.call-mobile-wr').removeClass('visible') setTimeout(function () { $('.call-mobile-wr').removeClass('open') },200) } function callMobile() { $('.call-button-mobile').click(function () { if($('.call-button-mobile').hasClass('close')){ mobOverlayRemove() closeCallMobileHide() $('.call-button-mobile').removeClass('close') $('.call-mobile-wr').removeClass('open') $('body').removeClass('off-scroll') $('.call-button-mobile.close').click(function () { }) } else { $('body').addClass('off-scroll') mobOverlayAdd() $(this).addClass('close') $('.call-mobile-wr').addClass('visible') setTimeout(function () { $('.call-mobile-wr').addClass('open') },20) } }) } function closeMobMenu() { $('body').on('click','.mob-overlay',function () { mobOverlayRemove() if($('#menu-mob-hidden').hasClass('visible')) { $('#menu-mob-hidden').removeClass('visible') setTimeout(function () { $('#menu-mob-hidden').removeClass('open') },200) $('body').removeClass('off-scroll') } if($('.call-button-mobile').hasClass('close')) { $('.call-button-mobile').removeClass('close') closeCallMobileHide() } }) $('.close-menu-mob .close_mob').click(function () { mobOverlayRemove() $('#menu-mob-hidden').removeClass('visible') setTimeout(function () { $('#menu-mob-hidden').removeClass('open') },200) $('body').removeClass('off-scroll') }) } function addOverlayMenu() { $('body').append('') } function menuCatalog() { var buttonDestktop = '.catalog_'; var buttonTablet = '.catalog_mob.tablet'; var buttonMobile = '.catalog_mob.mob'; var menuCatalog = $('.catalog-menu-wr'); $(''+buttonDestktop+','+buttonTablet+'').click(function (e) { e.preventDefault() if($(this).hasClass('homepage_notclick')) { var posCatalogMenu = $('.catalog-menu').offset().top $('body').animate( { scrollTop: posCatalogMenu-40 }, 500 ); } else { menuCatalog.toggleClass('opens') if(menuCatalog.hasClass('opens')){ $(''+buttonDestktop+'').addClass('open') $(''+buttonTablet+'').addClass('active') $('.catalog-menu li').removeClass('activ-li') } else { $(''+buttonDestktop+'').removeClass('open') $(''+buttonTablet+'').removeClass('active') } } }) $(buttonMobile).click(function () { mobOverlayAdd() $('body').addClass('off-scroll') menuCatalog.addClass('mobile_catalog_menu') setTimeout(function () { menuCatalog.addClass('op_mb_ct') },10) if(menuCatalog.hasClass('mobile_catalog_menu')){ function hideCatMob() { menuCatalog.removeClass('op_mb_ct') setTimeout(function () { menuCatalog.removeClass('mobile_catalog_menu') $('.catalog-menu li').removeClass('act_mb') mobOverlayRemove() $('body').removeClass('off-scroll') },200) } $('.mob-catalog-close').click(function () { hideCatMob() }) $('.mob-overlay').click(function () { hideCatMob() }) $('.catalog-menu li').click(function () { $('.catalog-menu li').removeClass('act_mb') if($(this).hasClass('act_mb')){ } else { $(this).addClass('act_mb') } }) } else { } }) $(window).resize(function () { if(($(window).width())>768){ menuCatalog.removeClass('mobile_catalog_menu') } else { // menuCatalog.addClass('mobile_catalog_menu'); //проверить } }) openSecondMenu(); function openSecondMenu() { var timeout; $('.catalog-menu li').hover(function () { if($('.catalog-menu-wr').hasClass('mobile_catalog_menu')){ } else { var this_ = $(this) if($(this).parent().hasClass('catalog-menu')){ timeout = setTimeout(function () { $('#overlay-menu').addClass('show') $('.catalog-menu li').removeClass('activ-li') this_.addClass('activ-li') $('.catalog-menu').addClass('openSecondLi') },300) } } }, function () { clearTimeout(timeout) }) } $('.mob_lang a').click(function () { $('.mob_lang a').removeClass('active'); $(this).addClass('active'); }) $('.lang_header a').click(function () { $('.lang_header a').removeClass('active'); $(this).addClass('active'); }) } hideMenuCatalog() function hideMenuCatalog() { function hideClickHoverMenu() { if( $('.catalog-menu-wr').hasClass('homepage_notclose')) { $('.catalog_').removeClass('open') $('.catalog_mob.tablet').removeClass('active') $('#overlay-menu').removeClass('show') $('.catalog-menu li').removeClass('activ-li') $('.catalog-menu').removeClass('openSecondLi') } else { $('.catalog-menu-wr').removeClass('opens') $('.catalog_').removeClass('open') $('.catalog_mob.tablet').removeClass('active') $('#overlay-menu').removeClass('show') $('.catalog-menu li').removeClass('activ-li') $('.catalog-menu').removeClass('openSecondLi') } } $('#overlay-menu').on('click', function () { hideClickHoverMenu() }) var timeoutOverlay $('#overlay-menu').hover(function () { timeoutOverlay = setTimeout(function () { hideClickHoverMenu() },300) }, function () { clearTimeout(timeoutOverlay) }) } sidebarChecked() clearFilter() filterMobile() closeFilterMobile() sortList() hoverCatalog() cityDeliveryCard() moreVariants() function sidebarChecked() { $('.sidebar input.custom-check + label a').click(function () { var checkSidebar = $(this).parent().parent().find('.custom-check') if(checkSidebar.is(':checked')) { checkSidebar.prop("checked", false); } else { checkSidebar.prop("checked", true); } }) } function clearFilter() { $('.resetFilters span').click(function () { var clearUrl = window.location.pathname; window.location = clearUrl; }) } function filterMobile() { $('.filter_mobile_').click(function (e) { e.preventDefault(); $(this).css({opacity:0}) $('.sidebar-transform').addClass('visible_') $('.sidebar-transform').animate({opacity: 1, left: 0}, 300) $('body').addClass('hidden_scroll-y') }) } function closeFilterMobile() { $('.close_filters').click(function () { $('.sidebar-transform').animate({opacity: 0, left: '-100%'}, 300) $('.filter_mobile_').css({opacity:1}) setTimeout(function () { $('.sidebar-transform').removeClass('visible_') },290) $('body').removeClass('hidden_scroll-y') }) } function sortList() { $('.sort-cat>a').click(function (e) { e.preventDefault() $('.sort-cat').toggleClass('active') }) $('.sort-cat ul li a').click(function () { $('.sort-cat ul li').css({display:'block'}) $(this).parent().css({display:'none'}) $('.sort-cat>a').html($(this).text()) $('.sort-cat').removeClass('active') }) var timeoutSort $('.sort-cat').hover(function () { clearTimeout(timeoutSort) },function () { timeoutSort = setTimeout(function () { $('.sort-cat').removeClass('active') },320) }) } function cityDeliveryCard() { $('.city-sel-deliv>a').click(function (e) { e.preventDefault() $('.city-sel-deliv').toggleClass('active') }) $('.city-sel-deliv ul li a').click(function () { $('.city-sel-deliv ul li').css({display:'block'}) $(this).parent().css({display:'none'}) $('.city-sel-deliv>a').html($(this).text()) $('.city-sel-deliv').removeClass('active') }) var timeoutSort $('.city-sel-deliv').hover(function () { clearTimeout(timeoutSort) },function () { timeoutSort = setTimeout(function () { $('.city-sel-deliv').removeClass('active') },320) }) } function hoverCatalog() { var timerBorder; var timerMove; $('.catalog-wr').hover(function () { var this_ = $(this) var slider = this_.parents('.slider-wr') var width = $(window).width() if(slider.length>0) { // $(this).parents('.owl-stage').find('.owl-item.active:nth-child(4)') var tst = $(this).parents('.owl-stage').find('.owl-item.active') var countSliders = 0 if(width>=751 && width<1183){ countSliders = 2 } else if (width>=1183){ countSliders = 3 } if(($(tst[countSliders]).index())==($(this).parents('.owl-item').index())){ this_.addClass('hover hover_left') } else { this_.addClass('hover') } } else { var num = ($(this).index())+1 if (num%3) { this_.addClass('hover') } else { this_.addClass('hover hover_left') } } setTimeout(function () { this_.find('.additional_wr').addClass('startAnim') },10) timerMove = setTimeout(function () { this_.find('.addit_wr').addClass('move') },200) timerBorder = setTimeout(function () { this_.addClass('hover-border') },200) },function () { var this_ = $(this) var slider = this_.parents('.slider-wr') this_.find('.additional_wr').removeClass('startAnim') this_.removeClass('hover hover-border') setTimeout(function () { this_.removeClass('hover hover_left') this_.find('.addit_wr').removeClass('move') },220) clearTimeout(timerBorder) clearTimeout(timerMove) }) } var catalog = $('.catalog-wrapp-all') if(catalog.length>0){ var banner = $('.banners').html() var bannerNum = $('.catalog-wrapp-all .catalog-wr:nth-child(4)') var bannerHeight = bannerNum.css('height') var winWidth = ($(window).width())+17 var bannerWidth = bannerNum.css('width') bannerWidth= bannerWidth.replace('px','') bannerWidth= +bannerWidth if($('html').hasClass('mobil') || $('html').hasClass('tablet')) { } else { // if(winWidth>767 && winWidth<992){ // console.log(winWidth) // $('.catalog-wrapp-all .catalog-wr:nth-child(5)').css({marginLeft:bannerWidth}) // } } $(window).resize(function () { var winWidth = ($(window).width())+17 var bannerWidth = bannerNum.css('width') bannerWidth= bannerWidth.replace('px','') bannerWidth= +bannerWidth if($('html').hasClass('mobil') || $('html').hasClass('tablet')) { } else { // if(winWidth>767 && winWidth<992){ // console.log(winWidth) // $('.catalog-wrapp-all .catalog-wr:nth-child(5)').css({marginLeft:bannerWidth}) // } else { // $('.catalog-wrapp-all .catalog-wr:nth-child(5)').attr('style','') // } } }) addBanners() function addBanners() { bannerNum.after(banner) $('.catalog-wrapp-all .banner_').css({height:bannerHeight}) $(window).resize(function () { bannerHeight = bannerNum.css('height') $('.catalog-wrapp-all .banner_').css({height:bannerHeight}) }) } } function citySelectHome() { $('.title_city-sel span.addCity').click(function () { $(this).toggleClass('active') if($(this).hasClass('active')) { $(this).parents('.city-sel').addClass('active') $('#hidden_shops').removeClass('_off') } else { $('#hidden_shops').addClass('_off') $(this).parents('.city-sel').removeClass('active') } }) $('#hidden_shops li').click(function () { $('#hidden_shops li').removeClass('active') $(this).addClass('active') var cityName = $(this).find('span.s_').html() $('span.addCity').empty().html(cityName) var cityPhones = $(this).find('div.phones_content').html() $('#shops_phones').animate({opacity:0},450, function () { $(this).animate({opacity:1},250).empty().html(cityPhones) }) // $('#shops_phones').empty().html(cityPhones) $('.title_city-sel span.addCity').removeClass('active') $('.city-sel').removeClass('active') $('#hidden_shops').addClass('_off') }) var timeoutCitySel $('.city-sel').hover(function () { clearTimeout(timeoutCitySel) },function () { timeoutCitySel = setTimeout(function () { $('.title_city-sel span.addCity').removeClass('active') $('.city-sel').removeClass('active') $('#hidden_shops').addClass('_off') },320) }) } function moreVariants() { $('.more_card').click(function () { var this_height = ($(this).parents('.options_bl').parents('.style').height()) $(this).parents('.options_bl').parents('.style').css({height:this_height}) $('.options_bl').removeClass('open_bl') $(this).parents('.options_bl').addClass('open_bl') }) $('.size_growth li a').click(function (e) { e.preventDefault(); $('.size_growth li a').removeClass('active'); $(this).addClass('active'); var this_index = $(this).parent().index() var ul = $('.size_growth-list') ul.removeClass('active') $(ul[this_index]).addClass('active') }) $('.colors-img ul li a').click(function (e) { e.preventDefault() $('.colors-img ul li a').removeClass('active') $(this).addClass('active') }) $('.size_growth-list li a').click(function (e) { e.preventDefault() $('.size_growth-list li').removeClass('active') $(this).parent().addClass('active') }) $('.weather_list li a').click(function (e) { e.preventDefault() $('.weather_list li').removeClass('active') $(this).parent().addClass('active') }) //закрытие $('.shadow_bl div').click(function () { $(this).parents('.options_bl').removeClass('open_bl') $(this).parents('.options_bl').parents('.style').css({height:'auto'}) }) } function sizeTable() { $('.size_table').click(function (e) { e.preventDefault(); var dataLink = $(this).attr('data-link') $('body').append('') }) $('body').on('click','#size-img a', function (e) { e.preventDefault() }) function closeSizeTb() { $('#size-img').remove() $('#overlay-size-tb').remove() } $('body').on('click','#size-img a span', function (e) { closeSizeTb() }) $('body').on('click','#size-img', function (e) { closeSizeTb() }) $('body').on('click','#overlay-size-tb', function (e) { closeSizeTb() }) } function descriptionCard() { $('.desk_name').click(function (e) { e.preventDefault() $('ul.description_list li').removeClass('active') $(this).parent().addClass('active') var this_index = $(this).parent().index() var blocks = $('.desk_list-wr') blocks.removeClass('active') $(blocks[this_index]).addClass('active') }) $('.btn_mobil_show_desk').click(function (e) { e.preventDefault(); if(($(this).parents('.desk_list-wr')).hasClass('active-mobile')) { $(this).parents('.desk_list-wr').removeClass('active-mobile') } else { $('.desk_list-wr').removeClass('active-mobile') $(this).parents('.desk_list-wr').addClass('active-mobile') } }) } function formComments() { $('.btn_scroll_to_comment').click(function (e) { e.preventDefault(); var commentScroll = $('.form-comm-wr').offset().top-30; $('body,html').animate({scrollTop:commentScroll},500, function () { $('#commentmodel-username').focus() }) }) } // var w = screen.width, // h = screen.height; // alert(w + 'x' + h + '('+$(window).width()+'x'+$(window).height()+')') // alert($(window).width()+'x'+$(window).height()) });