Something like this:
myHTMLWidget.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
event.preventDefault();
Element e = Element.as(event.getNativeEvent().getEventTarget());
if (e.getAttribute("href").contains("#")) {
e.scrollIntoView();
}
}
});
On Saturday, September 22, 2012 10:46:40 AM UTC-4, Andrei wrote:
>
> I think it is possible to attach a single ClickHandler to the HTML widget
> containing the HTML document. When clicked call preventDefault(), as Jen
> suggested, look at the source of the click, and if it is your anchor,
> scroll to the cursor position.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/KMJi2Ong0iMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.