Skip to content

Instantly share code, notes, and snippets.

@Maden-maxi
Created July 2, 2016 09:18
Show Gist options
  • Save Maden-maxi/00ed996bbc3df9c294c99c038f0d1273 to your computer and use it in GitHub Desktop.
Save Maden-maxi/00ed996bbc3df9c294c99c038f0d1273 to your computer and use it in GitHub Desktop.
adaptive menu
//анимация иконки меню
function animateBars(bars) {
bars.classList.toggle("change");
}
$(document).ready(function(){
//адаптивное меню
$('.menu-trigger').click(function () {
$('nav ul').slideToggle(500);
});
if($(window).width() <= 1024 ){
$('nav ul li a').click(function() {
$('nav ul').slideUp(400);
$('.menu-trigger').removeClass(' change');
});
}
$(window).resize(function(){
if ($(window).width() > 500) {
$('nav ul').removeAttr('style');
}
});
//Фиксированая шапка при скролле
$("header").removeClass("default");
$(window).scroll(function(){
if ($(this).scrollTop() > 600){
$("header").addClass("default").fadeIn('slow');
} else{
$("header").removeClass("default").fadeIn('slow');
};
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment