打开 jQuery 对话框后页面空白
page blank after opening jquery dialog
>我的jQuery对话框有一个小问题。这是.html页面的正文
<body onload="document_load()">
<div class="center" style="position: relative;">
<canvas style="position: absolute;" id="canvas" width="1300" height="1000" tabindex="0"></canvas>
<input type="button" id="state" value="Print State" style="position: absolute; top: 100px; left: 5px; width: 110px; height: 25px;" ondblclick="printState();" />
<input type="button" id="opener" value="Information" style="position: absolute; top: 140px; left: 5px; width: 110px; height: 25px;" onclick="open();" />
<label id="label" style="position: absolute; top: 400px; left: 200px; width: 500px; height: 19px; font: 200; color:black"></label>
<div id="dialog-message" title="Important information" style="display:none">
<span class="ui-state-default"><span class="ui-icon ui-icon-info" style="float:left; margin:0 7px 0 0;"></span></span>
<div style="margin-left: 23px;">
<p>
Example
<br /><br />
Example.<br /><br />
Another line which demonstrates the auto height adjustment of the dialog component.
</p>
</div>
</div>
</div>
</body>
"opener"按钮应该打开对话框,这是open()函数:
function open() {
$("#dialog-message").dialog({
modal: true,
draggable: false,
resizable: false,
position: ['center', 'top'],
show: 'blind',
hide: 'blind',
width: 400,
dialogClass: 'ui-dialog-osx',
buttons: {
"OK": function () {
$(this).dialog("close");
return false;
}
}
});
}
但是当我单击按钮时,页面变为空白,什么都没有。为什么?我试图将对话框消息<div>
放在中心<div>
之外,但结果是一样的。
将函数名称从 open
更改为其他名称。我不确定为什么会这样。也许是因为也有一些同名的内部函数。演示:http://jsfiddle.net/GCu2D/531/
function openD() { // I changed the name and it worked.
$("#dialog-message").dialog({
modal: true,
draggable: false,
resizable: false,
position: ['center', 'top'],
show: 'blind',
hide: 'blind',
width: 400,
dialogClass: 'ui-dialog-osx',
buttons: {
"OK": function() {
$(this).dialog("close");
return false;
}
}
});
}
相关文章:
- 对DataTable jquery进行排序,排除文本字段中的空白
- 当从jquery的点击事件中的每个循环创建的数组到它之外时,它显示空白数组
- jQuery's$.post只返回一个空白数据
- 使用jquery如何自动删除下拉列表中的第一个空白选项(如果它依赖于另一个选项)
- 如何在Jquery Mobile和RequireJS中使用window.location.href时避免出现空白页
- 如何在对象上使用trim函数来删除空白jquery
- iOS7和jQuery mobile:面板打开和关闭后会变为空白
- 如何使用jquery在html表的右侧添加一定数量的空白列
- $('body').html()从来自Firefox中$jQuery.post的响应数据中给出了空白内容
- 打开 jQuery 对话框后页面空白
- jQuery页面过渡使上一页为空白
- 如何在导航 jQuery 中的特定 href 标签上给出目标空白
- 排除 JQuery 轮播中的空白图像
- jquery $.ajax 的 MVC 3 反序列化请求 json 到对象中填充空值而不是空白字符串
- JQuery移除模糊上的空白
- jQuery在连接时附加空白(无任何内容)
- jquery dilaog没有显示404号视图,只是空白屏幕mvc 4
- 使用jQuery时为空白页
- 当我点击空白区域时,Jquery Mobile会出现奇怪的空间
- 为什么我的jquery.load()状态为空白