get scroll height of div jquery code example
Example: if window width jquery then display a div at scroll
function updateContainer() {
$(window).scroll(function() {
if ( $(window).width() > 960 ) {
if( $(window).scrollTop() > 40 && $(document).height() - $(window).height() > 79 ) {
add_desktop();
} else if ($(window).scrollTop() <= 40 ) {
remove_desktop();
}
} else {
if( $(window).scrollTop() > 40 && $(document).height() - $(window).height() > 160 ) {
add_mobile();
} else if ($(window).scrollTop() <= 40 ) {
remove_mobile();
}
}
});
}