Reputation: 210705
How do I perform a "page down" operation with Javascript/jQuery so that it works correctly if the user has zoomed in/out?
i.e. it should scroll no more and no less than would happen if the user had actually pressed the key, whether or not the user had messed up the zoom settings or fonts or DPI or whatever.
There may not be any particular element at the target position. I just want to "page down", not caring whether there's a particular element at the destination. (i.e. I can't use scrollTo
.)
Also, animation would be great, but not required. :)
Upvotes: 1
Views: 3033
Reputation: 5520
$(document).scrollTop($(document).scrollTop()+$(window).height());
EDIT: as per your comment
I'm not able to trigger the native page down functionality with javascript, and since we can't assume that every browser and every operating system will handle pagedown to the exact same number of pixels, I suppose that means you can't do it.
Upvotes: 5