Domanda

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?

È stato utile?

Soluzione

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

Altri suggerimenti

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)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top