javascript - How to scroll to a div id in GWT -
i have webpage iframe in gwt application running. webpage has <div id="head">
. not possible scroll in iframe (intended) webpage has example height of 1000px. @ bottom there button , want when clicks on button (note: button in gwt application) want scroll top.
that means iframe needs force parent window scroll top. tried jsni function this:
public static native void scrolltotop() /*-{ $wnd.top.scrollto(0,0); }-*/;
but didn't work. new idea scroll div id "header". know how accomplish this?
i tried this:
document.getelementbyid('header').scrollintoview();
but seems not work (because should in jsni manner?).
thanks inputs!
it fails because gwt runs in iframe, document
references gwt's iframe, , not "html host page". have use $doc
in jsni reference document (just $wnd
instead of window
).
but don't need jsni that; plain old java/gwt do:
document.get().getelementbyid("header").scrollintoview();
Comments
Post a Comment