Wicket ModalWindow的位置 [英] Wicket ModalWindow position

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

问题描述

我需要在模态窗口显示在中间之前修改它的位置。

I need to modify the position of the modal window before it gets displayed in the middle.

我有一个ajax按钮,它将打开模态窗口。在onClick方法中我尝试了类似的东西...

I have a ajaxbutton which will open the modal window. In the onClick method I tried something like...

target.appendJavaScript("$(\".wicket-modal\").css('width', 888+'px');");

target.appendJavaScript("$(\"[id^=_wicket_window]\").css('top', 100+'px');");

及其更多变种......

and some more variations of it...

似乎我无法在显示之前操纵ModalWindow的位置。但是我可以在这个模态窗口中操纵元素的位置和大小。

It seems I can't manipulate the position of the ModalWindow before it gets displayed. But I can manipulate the position and size of an element INSIDE this modal window.

例如:

target.appendJavaScript("$(\".formdiv\").css('width', 888+'px');");

有效。 formdiv是模态窗口中的div。它改变了它的宽度,颜色和我想要的东西。

works. "formdiv" is a div in the modal window. It changes it's width, color and what I want.

但是我首先需要在其他地方使用ModalWindow的位置。我怎么能这样做?

But I need the position of the ModalWindow somewhere else at the first appearance. How can I do it?

推荐答案

对于我未知的原因,ModalWindow在JavaScript超时为0秒时打开。因此,您需要在超时时再次执行自定义JavaScript,例如:

For an unknown reason to me the ModalWindow is opened with JavaScript timeout of 0 seconds. So you need to execute your custom JavaScript again with a timeout, e.g.:

target.appendJavaScript("setTimeout(function() {$('.wicket-modal').css('width', 888+'px');}, 10);");

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

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