Reputation: 11
How to alert when scroll page every 200px;
i want to alert some text when user sceoll page every 200px; how can i do that?
i try like this but not work
$(window).scroll(function () {
if ($(window).scrollTop()%200 != '0') {
alert($(window).scrollTop());
}
});
Upvotes: 0
Views: 983
Reputation: 85545
You should check like this:
if ($(window).scrollTop() % 200 == 0) {
alert($(window).scrollTop());
}
Upvotes: 1