$(document).ready(function() { //Обработка формы $("form").submit(function() { $.ajax({ type: "POST", url: "/ajax/mail_smtp.php", data: $(this).serialize() }).done(function() { $("#popup__form").hide(); $("#popup__thanks").show(); $("#popup__thanks .popup__content").slideDown(); }); return false; }); }); //Настройки скроллинга $('a[href^="#"]').click(function () { elementClick = $(this).attr("href"); destination = $(elementClick).offset().top; $('html, body').animate( { scrollTop: destination - 77}, 1100 ); return false; }); $(window).scroll(function () { $('section[id]').each(function(){ var id = $(this).attr('id'); if($(this).offset().top-100 < $(window).scrollTop()){ $('.active').removeClass('active'); $('.header__ul li a[href=#'+id+']').addClass('active'); $('.pushy-link a[href=#'+id+']').addClass('active'); } }); }); $(window).scroll( function() { var top = 0; top = $(window).scrollTop(); if(top < 100){ $('.active').removeClass('active'); } }); //Настройки слайдера $('.footer__slider').slick({ slidesToShow: 3, slidesToScroll: 1, prevArrow: ".footer__slider__arrow__left", nextArrow: ".footer__slider__arrow__right", responsive: [ { breakpoint: 765, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }); $('.sale__slider').slick({ slidesToShow: 1, slidesToScroll: 1, prevArrow: ".sale__arrow__left", nextArrow: ".sale__arrow__right" }); //Маска для телефона $(function(){ $(".phone").mask("8(999) 999-9999"); }); //Настройки попап окон $('.popup_close').click(function(){ $("#popup__thanks .popup__content").slideUp(); $("#popup__thanks").slideUp(); $("#popup__form").slideUp(); $('#popup__form .popup__content').slideUp(); }); /* $('.header__btn').click(function(){ $("#popup__form").show(); $('#popup__form .popup__content').slideDown(); }); */ $('.footer__info__btn').click(function(){ $("#popup__form").show(); $('#popup__form .popup__content').slideDown(); }); //Открытие и закрытие меню $('.header__menu__btn').click(function(){ $('body').toggleClass('pushy-open-right'); $('.menu-icon').toggleClass('menu-icon-active'); }); $('.pushy a').click(function(){ $('body').removeClass('pushy-open-right'); $('.menu-icon').removeClass('menu-icon-active'); }); $('.site-overlay').click(function(){ $('.menu-icon').removeClass('menu-icon-active'); }); //Анимации function anim1() { $('.animate1').animate ({ left: '+=2320', }, 19000, 'linear', function() { anim1(); }); $('.animate1').css({left:-400}); } function anim2() { $('.animate2').animate ({ left: '+=2320', }, 12000, 'linear', function() { anim2(); }); $('.animate3').css({left:-400}); } function anim3() { $('.animate3').animate ({ left: '+=2320', }, 12000, 'linear', function() { anim3(); }); $('.animate3').css({left:-400}); } function anim4() { $('.animate4').animate ({ left: '+=2320', }, 16000, 'linear', function() { anim4(); }); $('.animate4').css({left:-400}); } function anim5() { $('.animate5').animate ({ right: '-=60', top: '+=20' }, 13000, 'linear', function() { $('.animate5').animate ({ right: '-=40', top: '+=40' }, 15000, 'linear', function() { $('.animate5').animate ({ right: '+=120', top: '-=60' }, 40000, 'linear', function() { anim5(); }); }); }); } function anim6() { $('.animate6').animate ({ right: '+=50', top: '+=20' }, 10000, 'linear', function() { $('.animate6').animate ({ right: '-=20', top: '+=40' }, 12000, 'linear', function() { $('.animate6').animate ({ right: '-=30', top: '-=60' }, 30000, 'linear', function() { anim6(); }); }); }); } function anim7() { $('.animate7').animate ({ right: '-=30', top: '-=20' }, 5000, 'linear', function() { $('.animate7').animate ({ right: '-=20', top: '+=40' }, 6000, 'linear', function() { $('.animate7').animate ({ right: '+=50', top: '-=20' }, 9000, 'linear', function() { anim7(); }); }); }); } function anim8() { $('.animate8').animate ({ right: '-=30', top: '-=20' }, 6000, 'linear', function() { $('.animate8').animate ({ right: '-=20', top: '+=40' }, 8000, 'linear', function() { $('.animate8').animate ({ right: '+=50', top: '-=20' }, 10000, 'linear', function() { anim8(); }); }); }); } function anim9() { $('.animate9').animate ({ right: '-=30', top: '-=20' }, 2000, 'linear', function() { $('.animate9').animate ({ right: '-=20', top: '+=40' }, 4000, 'linear', function() { $('.animate9').animate ({ right: '+=50', top: '-=20' }, 6000, 'linear', function() { anim9(); }); }); }); } function anim12() { $('.animate12').animate ({ right: '-=60', top: '+=20' }, 6000, 'linear', function() { $('.animate12').animate ({ right: '-=40', top: '+=40' }, 9000, 'linear', function() { $('.animate12').animate ({ right: '+=120', top: '-=60' }, 17000, 'linear', function() { anim12(); }); }); }); } function anim13() { $('.animate13').animate ({ left: '-=50', top: '+=40' }, 5000, 'linear', function() { $('.animate13').animate ({ left: '+=30', top: '-=20' }, 7000, 'linear', function() { $('.animate13').animate ({ left: '+=20', top: '-=20' }, 18000, 'linear', function() { anim13(); }); }); }); } function anim14() { $('.animate14').animate ({ left: '+=2320', }, 60000, 'linear', function() { anim14(); }); $('.animate14').css({left:-700}); } function anim15() { $('.animate15').animate ({ left: '+=2320', }, 20000, 'linear', function() { anim15(); }); $('.animate15').css({left:-700}); } function anim16() { $('.animate16').animate ({ left: '+=1700', bottom: '+=100', }, 10000, 'linear', function() { $('.animate16').animate ({ left: '+=1020', bottom: '-=100', }, 7000, 'linear', function() { $('.animate16').css({left:-400, bottom: 200}); anim16(); }); }); } function anim17() { $('.animate17').animate ({ left: '+=1700', bottom: '-=300', }, 8000, 'linear', function() { $('.animate17').animate ({ left: '+=1320', bottom: '+=200', }, 6000, 'linear', function() { $('.animate17').css({left:-400, bottom: 800}); anim17(); }); }); } function anim18() { $('.animate18').animate ({ left: '+=900', bottom: '-=100', }, 5000, 'linear', function() { $('.animate18').animate ({ left: '+=2120', bottom: '+=200', }, 2000, 'linear', function() { $('.animate18').css({left:-400, bottom: 500}); anim18(); }); }); } function anim19() { $('.animate19').animate ({ left: '+=1700', bottom: '+=100', }, 17000, 'linear', function() { $('.animate19').animate ({ left: '+=1020', bottom: '-=200', }, 10000, 'linear', function() { $('.animate19').css({left:-400, bottom: 350}); anim19(); }); }); } function anim20() { $('.animate20').animate ({ left: '+=1700', bottom: '+=500', }, 12000, 'linear', function() { $('.animate20').animate ({ left: '+=1320', bottom: '-=200', }, 8000, 'linear', function() { $('.animate20').css({left:-400, bottom: 200}); anim20(); }); }); } function anim21() { $('.animate21').animate ({ left: '+=700', bottom: '+=150', }, 7000, 'linear', function() { $('.animate21').animate ({ left: '+=2120', bottom: '-=30', }, 12000, 'linear', function() { $('.animate21').css({left:-300, bottom: 900}); anim21(); }); }); } function anim22() { $('.animate22').animate ({ left: '+=1400', bottom: '-=300', }, 10000, 'linear', function() { $('.animate22').animate ({ left: '+=1520', bottom: '+=100', }, 5000, 'linear', function() { $('.animate22').css({left:-300, bottom: 1100}); anim22(); }); }); } function anim23() { $('.animate23').animate ({ left: '+=1200', bottom: '+=20', }, 14000, 'linear', function() { $('.animate23').animate ({ left: '+=1820', bottom: '-=200', }, 10000, 'linear', function() { $('.animate23').css({left:-400, bottom: 1000}); anim23(); }); }); } function anim24() { $('.animate24').animate ({ left: '+=2800', }, 14000, 'linear', function() { $('.animate23').css({left:-400}); anim24(); }); } function stopAnim(){ $('.animate1').stop(); $('.animate2').stop(); $('.animate3').stop(); $('.animate4').stop(); $('.animate5').stop(); $('.animate6').stop(); $('.animate7').stop(); $('.animate8').stop(); $('.animate9').stop(); $('.animate12').stop(); $('.animate13').stop(); $('.animate14').stop(); $('.animate15').stop(); $('.animate16').stop(); $('.animate17').stop(); $('.animate18').stop(); $('.animate19').stop(); $('.animate20').stop(); $('.animate21').stop(); $('.animate22').stop(); $('.animate23').stop(); $('.animate24').stop(); } anim1(); anim2(); anim3(); anim4(); anim5(); anim6(); anim7(); anim8(); anim9(); anim12(); anim13(); anim14(); anim15(); anim16(); anim17(); anim18(); anim19(); anim20(); anim21(); anim22(); anim23(); anim24(); function windowSize(){ if ($(window).width() <= '768'){ stopAnim(); } else { anim1(); anim2(); anim3(); anim4(); anim5(); anim6(); anim7(); anim8(); anim9(); anim12(); anim13(); anim14(); anim15(); } } $(window).load(windowSize); // при загрузке $(window).resize(windowSize); // при изменении размеров // или "два-в-одном", вместо двух последних строк: $(window).on('load resize',windowSize); //Эффекты наведения $('.social__vk').hover( function () { // this is the mouseon event $(this).attr('src','img/footer/vk-hover.png'); }, function () { // this is the mouseout event $(this).attr('src','img/footer/vk.png'); } ); $('.social__instagram').hover( function () { // this is the mouseon event $(this).attr('src','img/footer/instagram-hover.png'); }, function () { // this is the mouseout event $(this).attr('src','img/footer/instagram.png'); } ); $('.social__ok').hover( function () { // this is the mouseon event $(this).attr('src','img/footer/ok-hover.png'); }, function () { // this is the mouseout event $(this).attr('src','img/footer/ok.png'); } ); $('.footer__slider__arrow').hover( function () { // this is the mouseon event $(this).attr('src','img/sale/arrow-active.png'); }, function () { // this is the mouseout event $(this).attr('src','img/sale/arrow.png'); } ); $('.sale__arrow').hover( function () { // this is the mouseon event $(this).attr('src','img/sale/arrow-active.png'); }, function () { // this is the mouseout event $(this).attr('src','img/sale/arrow.png'); } ); $('.popup_close').hover( function () { // this is the mouseon event $(this).attr('src','img/close-hover.png'); }, function () { // this is the mouseout event $(this).attr('src','img/close.png'); } );