Last active
July 11, 2016 20:24
-
-
Save Ferrmolina/84f881a3bd83afdcbf46 to your computer and use it in GitHub Desktop.
Fixed header, with animation.
This file contains hidden or 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 header = $('#index'); | |
$(function(){ header.data('size','grande'); }); | |
$(window).scroll(function(){ | |
if ($(document).scrollTop() > 150) { | |
if (header.data('size') == 'grande') { | |
header.data('size','chico'); | |
header.stop().addClass('header-top').animate({ padding:'5px 0px 5px 0px' }, 600); | |
} | |
} else { | |
if (header.data('size') == 'chico') { | |
header.data('size','grande'); | |
header.stop().removeClass('header-top').animate({ padding:'20px 0px 20px 0px' }, 600); | |
} | |
} | |
}); | |
$(document).ready(function(){ | |
$(function(){ | |
$('.slide:gt(0)').hide(); | |
setInterval(function(){ | |
$('.slide:first-child').fadeOut(1200).next('.slide').fadeIn(1200).end().appendTo('#slider'); | |
}, 4500); | |
}); | |
}); | |
$('#btn-menu').change(function() { | |
if($(this).is(":checked")) { | |
$('#selector').html('<img src="css/images/close-icon.png" height="35" width="35" alt="Close Icon" />'); | |
} else { | |
$('#selector').html('<img src="css/images/nav-icon.png" height="45" width="45" alt="Menu Icon" />'); | |
} | |
}); | |
$(function(){ header.data('size','grande'); }); | |
$(window).scroll(function(){ | |
if ($(document).scrollTop() > 150) { | |
if (header.data('size') == 'grande') { | |
header.data('size','chico'); | |
header.stop().addClass('header-top').animate({ padding:'5px 0px 5px 0px' }, 600); | |
} | |
} else { | |
if (header.data('size') == 'chico') { | |
header.data('size','grande'); | |
header.stop().removeClass('header-top').animate({ padding:'20px 0px 20px 0px' }, 600); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment