I created an Link to another page's anchor similar to the code shown
below. The anchor actually gets tagged on to the bookmarkable URL.
However, for some reason the browser does not jump to my anchor.

 

Not sure what's going on - is there a particular way I have to create an
anchor in Wicket so that the URL causes the browser to scroll further
down in the page?

 

Thanks,

 

Michael

 

 

public class AnchoredBookmarkablePageLink extends BookmarkablePageLink {

 

  private static final long serialVersionUID = 1L;

 

  private IModel stringAnchor;

 

  public AnchoredBookmarkablePageLink(String id, Class pageClass, IModel


anchor) {

    super(id, pageClass);

    this.stringAnchor = anchor;

  }

 

  public AnchoredBookmarkablePageLink(String id, Class pageClass, 

PageParameters params, IModel anchor) {

    super(id, pageClass, params);

    this.stringAnchor = anchor;

  }

 

  @Override

  protected CharSequence appendAnchor(ComponentTag tag, CharSequence
url) {

    url = url + "#" + stringAnchor.getObject().toString();

    return url;

  }

  

}

 

Reply via email to