GWT popuppanel的静态定位 [英] static positioning of the GWT popuppanel

查看:104
本文介绍了GWT popuppanel的静态定位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个GWT弹出式面板来显示一些垂直堆放在我的jsp页面中的信息。我面临的问题是,一旦显示弹出式面板,它不会保持其设定的位置。我使用setPopupPosition()设置弹出面板的位置。
但是,无论用户何时滚动浏览器,显示的弹出窗口都会相应地上下移动。它不保持原来的位置,它显示的位置。

我尝试将CS​​S属性设置为(位置:固定;)应用在弹出面板上,但它不起作用。我读了一些地方,为了让html元素静态显示,我们可以使用position:fixed和width:100%来实现这一点。但在我的情况下,我不能将宽度设置为100%,因为我需要为特定大小显示弹出式面板。

有没有办法在GWT中实现弹出面板的固定位置?我是否需要听取浏览器的滚动条事件以修复位置或者是否可以以不同的方式处理。



这是我的一段代码,用于设置弹出窗口在GWT中的位置。

  final PopupPanel simplePopup = new PopupPanel(false); 
_beamMenu = simplePopup;
rendererDisplay(response,simplePopup,true);
int left = _beamIcon.getAbsoluteLeft()+ _beamIcon.getOffsetWidth() - simplePopup.getOffsetWidth();
int top = _beamIcon.getAbsoluteTop() - simplePopup.getOffsetHeight();
simplePopup.setPopupPosition(left,top);

任何有关这方面的帮助都将非常感谢。



非常感谢,
Asheesh

解决方案

添加一个css: position:固定!重要;


I'm using a GWT popup panel for displaying some information stacked up vertically in my jsp page. The problem I'm facing is that, once the popup panel is displayed, it doesn't hold on to its set position. I'm setting the position of the popup panel using setPopupPosition(). However, whenever the user scrolls the browser, the popup panel displayed moves up and down accordingly. It doesn't maintain its original position, where it was displayed.

I've tried setting the css property to (position: fixed;) applied on the popup panel, but it doesn't work. I read someplace, that in order for an html element to be displayed statically, we can use the position: fixed, and width: 100% to achieve that. But in my case, I can't set the width to 100%, since I need the popup panel to be displayed for a specific size.

Is there a way to achieve the fixed position of the popup panel in GWT? Would I have to listen to browser's scrollbar events in order to fix the position or can it be handled differently.

This is my piece of code, which I use to set the popup panel's position in GWT.

           final PopupPanel simplePopup = new PopupPanel(false);
           _beamMenu = simplePopup;
           rendererDisplay(response, simplePopup,true);
           int left =_beamIcon.getAbsoluteLeft() + _beamIcon.getOffsetWidth() - simplePopup.getOffsetWidth();
           int top = _beamIcon.getAbsoluteTop() - simplePopup.getOffsetHeight();
           simplePopup.setPopupPosition(left, top);

Any help in this regard will be highly appreciated.

Many thanks, Asheesh

解决方案

add a css with: position: fixed !important;

这篇关于GWT popuppanel的静态定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆