jQuery UI自动打开
jQuery UI Auto Open
有人能帮我设置jQuery UI对话框自动打开吗?谢谢我当前的代码:
<script type="text/javascript">
function openDialog(url) {
$("<div class='popupDialog'>Loading...</div>")
.dialog({
autoOpen: true,
closeOnEscape: true,
width: 'auto',
height: 'auto',
modal: true,
beforeClose: function(){ $(this).remove(); }
}).bind('dialogclose', function() {
jdialog.dialog('destroy');
}).load(url, function() {
$(this).dialog("option", "position", ['center', 'center'] );
$(this).dialog("open");
});
}
$(window).resize(function() {
$(".ui-dialog-content").dialog("option", "position", ['center', 'center']);
});
</script>
我想这就是您想要的:
$(document).ready(function () { //All jQuery code that affects the DOM should run after the DOM is in a readyState.
'use strict'; //ECMAScript 5, yay!
var url = 'www.somsite.com';
function openDialog(url) {
//added return statement to return the dialog
//Using "<div>content</div>" as the "selector" creates a new div element that is not attached to the DOM.
return $('<div class="popupDialog">Loading...</div>').dialog({
'autoOpen': true,
'closeOnEscape': true,
'width': 'auto',
'height': 'auto',
'modal': true,
'beforeClose': function () {
$(this).remove();
}
}).bind('dialogclose', function () {
$(this).dialog('destroy');
}).load(url, function () {
$(this).dialog('option', 'position', ['center', 'center']);
$(this).dialog('open');
});
}
$('body').append(openDialog(url)); //Append created DOM element to the DOM
$(window).resize(function () {
$('.ui-dialog-content').dialog('option', 'position', ['center', 'center']);
});
});
相关文章:
- jQuery UI自动完成突然停止工作
- Rails/JSON:如何将JSON用于jquery UI自动完成表单
- 停止jQuery UI滑块移动超过给定值
- Jquery UI自动完成无法工作
- jquery ui滑块上的滑块值
- jQuery UI可排序-多连接列表拖动
- 使用Jquery ui时滑块无法工作
- JQuery UI可拖动潜水与滚动棒到鼠标
- jQuery UI自动完成-修改问题
- JQuery UI日期选择器:在选择出发日期时自动弹出返回日期
- 阻止选项卡缓存jquery ui
- 将jQuery UI Timepicker Addon与React一起使用
- 如何在页面重新加载时显示jquery ui对话框
- jquery ui自动完成导致标头错误
- jquery UI draggable:UI.children不是一个函数
- 在JQuery UI Accordion Sortable中使用touchpunch无法正确使用touch
- Jquery UI对话框不会消失
- 无限循环onsen UI + jquery
- Ignite UI - (jQuery) - 无法使用 ig.excel.WorksheetCellComment 在单
- 可排序的UI jquery的奇怪行为