我有一个链接:
<a class="fg-button ui-state-default fg-button-icon-left assistButton" pbcType="download" title="Click for download information"><span class="ui-icon ui-icon-document"></span>File</a>
我有一些 jQuery:
$(".assistButton").click(function(){
$('#dialog').css('color', '#000000');
$("#dialog").dialog({
bgiframe: true,
position: 'center',
width: $(window).width()-80,
height: $(window).height()-80,
title: 'Some title',
modal: true,
buttons: { "Close": function() { $(this).dialog("destroy"); }}
});
})
在您向下滚动屏幕之前,此操作有效(对话框正确打开)。一旦向下滚动屏幕,对话框就不会出现,屏幕会变灰,因为它是一个模式对话框。
我的假设是
position: 'center',
会将其置于屏幕中央,但我猜它是从左到右居中,而不是从上到下...?
在 IE 中它工作正常,在 Windows 或 OS X 上的 Firefox 中它不起作用。
我错过了什么?我在网络上找到了其他一些(以 http://dev.jqueryui.com/ticket/4539 为例),但到目前为止没有任何效果。
编辑: 在 Firefox 中,它会打开,但它位于“首屏”,我无法向上滚动到它。它就在那里,只是我看不到而已。
最佳答案
jQuery UI 1.8.3 or 1.8.4 (due to a mis-build 1.8.3 == 1.8.4) release对此部门进行了一些更改,最值得注意的是:
DIALOG
The dialog plugin has also been updated to allow full usage of the position utility. Setting the dialog’s position with a string or array is still possible, but will be removed in a future version.
对定位进行了彻底修改,以使用在小部件之间共享的基本位置实用程序,因此现在可以更干净地处理滚动页面之类的代码。在我们遇到的有关您的错误的一个问题页面中,1.8.4 版本修复了该问题。
关于在 Firefox 中滚动页面后,jQuery UI 对话框不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3205510/