Question

How do I get the height of the page on scroll?

Is it possible to determine how much the user has scrolled the page and determine the position of length that it covered.

I have tried:

var scroll=$wnd.scrollTop  

in JavaScript but it is giving result undefined?

Am I doing it wrong?

Was it helpful?

Solution

Try it using GWT JSNI.

public static native int getScrollTop()
/*-{
    return $wnd.pageYOffset;
}-*/;

For more info have a look at window size and scrollbar position

OTHER TIPS

I used the next code to get the current scroll position of the webpage:

var y = $(document).scrollTop();

It worked for me.
(I hope that's what you were looking for)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top