Last active
August 29, 2015 14:25
-
-
Save Alex-Space/517b075818c2c1ba26ef to your computer and use it in GitHub Desktop.
doc jQuery
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
// Сделать высоту блоков такой, какая у самого высокого | |
function make_the_higher() { | |
var elementHeights = $('.main-posts .post-box').map(function() { | |
return $(this).height(); | |
}).get(); | |
// Math.max takes a variable number of arguments | |
// `apply` is equivalent to passing each height as an argument | |
var maxHeight = Math.max.apply(null, elementHeights); | |
// Set each height to the max height | |
$('.main-posts .post-box').height(maxHeight); | |
} | |
make_the_higher(); | |
// Сделать скролл к элементу по клику на него | |
$('.header-tab-elem').live( 'click', function() { | |
$(window).scrollTop( $(this).offset().top ); | |
}); | |
// Сделать то же самое но плавно | |
$('html, body').animate({scrollTop: ЭЛЕМЕНТ_К_КОТОРОМУ_СКОЛЛИМ.offset().top}, 300); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment