How to fix the position of a PopupPanel relative to the page when scrolling

3.1k views Asked by At

Essentially the popup panel stays a fixed position to the browser panel - where as I want it to scroll with the page.

I've tried setting the CSS element of the popup panel, with 'position: fixed !important' but no success.

This question seems to explain a similar problem, but I'm still not exactly sure what the fix is supposed to be.

Any idea how to do this?

1

There are 1 answers

0
Jama A. On BEST ANSWER

You can add WindowScrollHandler by doing like this:

    Window.addWindowScrollHandler(new Window.ScrollHandler() {
       public void onWindowScroll(Window.ScrollEvent event) {
         popupPanel.setPopupPosition(event.getScrollLeft()+fromLeft,
                                      event.getScrollTop()+fromTop);
       }
    });