Created
October 10, 2016 13:38
-
-
Save 0632347878/f0a319cdb1f7312935f9e01c62882b3f to your computer and use it in GitHub Desktop.
page to scrool, fix menu on top, processing links on click
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Фиксация меню сверху | |
var nav= $(".navigation"); | |
if (pageYOffset>499) { | |
nav.addClass("fix"); | |
} | |
window.onscroll = function() { | |
if (pageYOffset>499) { | |
nav.addClass("fix"); | |
} | |
if (pageYOffset<=499) { | |
nav.removeClass("fix"); | |
} | |
} | |
//Настройка плагина Page2Scroll | |
$(".navigation a, #mobile-menu a, .top").mPageScroll2id({ | |
offset: 75, | |
scrollSpeed : 1000 | |
}); | |
//Обработка кликов на hamburger | |
$(".menu-trigger").click(function (e) { | |
$(this).toggleClass("active"); | |
$("#mobile-menu").toggleClass("mobile-menu-active"); | |
e.preventDefault(); | |
}); | |
//Обработка кликов на ссылки в мобильном меню | |
$("#mobile-menu a").click(function() { | |
$("#mobile-menu").removeClass("mobile-menu-active"); | |
$(".menu-trigger").toggleClass("active"); | |
}); | |
//Конфиг анимаций | |
wow = new WOW( | |
{ | |
boxClass: 'wow', // default | |
animateClass: 'animated', // default | |
offset: 400, // default | |
mobile: false, // default | |
live: true // default | |
} | |
) | |
wow.init(); | |
//Ajax отправка email | |
$("#feedback").submit(function() { | |
var msg = $("#feedback").serialize(); | |
$.ajax({ | |
type: "POST", | |
url: "php/mail/mail.php", | |
data: msg, | |
success: function() { | |
alert("Ваш заказ успешно принят, мы свяжемся с Вами в течении ближайшего рабочего дня."); | |
} | |
}); | |
}); | |
//Google аналитика | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'UA-84530813-1', 'auto'); | |
ga('send', 'pageview'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment