Friday, October 5, 2012

Re: In page (html) anchors don't work - they interfere with history tokens

thx i'll try it,

until now i thought "normal" html works flawlessly within gwt webapp but in this case i am disabused.

On Saturday, 22 September 2012 17:09:30 UTC+2, Andrei wrote:
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/-/5TqD_blgA54J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment