How to check the scrollbar is scrolled down a half.
I mean when the user scrolls down over a half of screen, it should alert a message.
How to check the scrollbar is scrolled down a half.
I mean when the user scrolls down over a half of screen, it should alert a message.
since you are using jquery, you could use jQuery.scroll():
$(window).scroll(function() {
if ($(window).scrollTop() > $(window).height() / 2) {
alert('At Half the screen');
}
});
You can get the half of the visible screen by
$(window).height() / 2
Half of the entire size of your page would be
$(document).height() / 2
Then compare the result against the scroll position:
$(window).scrollTop();