Answer the question
In order to leave comments, you need to log in
How to make it so that when scrolling, the block that fits to the end of the browser window is fixed?
The essence of the question is that the content is divided into two parts - vertical, one part is longer than the other,
how to make it so that when scrolling the page, one of the parts is fixed when it ends, or approaches the footer of the browser window itself, facebook example
Answer the question
In order to leave comments, you need to log in
so far there is but very damp
jQuery(function($) {
function fixDiv() {
var $cache = $('#cont');
if ($(window).scrollTop() >= $(window).height())
$cache.css({
'position' : 'fixed',
'top': 'auto',
'bottom': 0,
'left': 595,
'-webkit-transform' : 'translateZ(0)',
});
else
$cache.css({
'position' : 'absolute',
'top' : 0,
'bottom' : 'auto',
'left': 482,
});
}
$(window).scroll(fixDiv);
fixDiv();
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question