jQuery 对话框 moveToTop 问题

标签 jquery jquery-ui jquery-ui-dialog

jQuery UI v1.10 似乎在页面上堆叠多个对话框时存在问题,当单击任何对话框时,它将刷新所有打开的对话框。

这里有一些 fiddle 。使用相同的代码:

HTML

<div id="div1" class='d' data-isrc='http://www.slashdot.org'>
</div>
<div id="div2" class='d' data-isrc='http://www.cnn.com'>
</div>

JS

var opts = {
    height: 200,
    width: 300,
    autoOpen: true,
    open: function(){
        var src = $(this).data("isrc"),
            $iframe = $("<iframe seamless='seamless' src='" + src + "'>");

        console.log(src);
        $(this).append($iframe);

    }
};
$("#div1").dialog(opts);

$("#div2").dialog(opts);

这个 fiddle 使用 jQuery 1.9.1 和 jQueryUI 1.9.2,并且按照我需要的方式运行:http://jsfiddle.net/REmJb/

这个 fiddle 使用 jQuery 2.0.2 和 jQueryUI 1.10.3,并显示问题:http://jsfiddle.net/UBV4v/

如何使上述链接在较新的 jQuery 框架上顺利工作(无需刷新)?

预计到达时间: 看来这可以追溯到 insertBefore() 方法的新方法。引用the documentation :

Before jQuery 1.9, the append-to-single-element case did not create a new set, but instead returned the original set which made it difficult to use the .end() method reliably when being used with an unknown number of elements.

...但 v1.9 中不存在该问题,所以也许不存在。

最佳答案

这是我添加到脚本中以禁用此行为的内容。

jQuery.ui.dialog.prototype._moveToTop = function(event, silent) {
    return true;
};

My Question

关于jQuery 对话框 moveToTop 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17799023/

相关文章:

jquery-ui - jQuery UI 日期选择器 'defaultDate' 选择了错误的月份

jquery - 让 jquery ui timepicker 不在模式中自动打开

Jquery 对话框新按钮

javascript - 打开 jquery 对话框时保持滚动位置

javascript - 如何从单个表单元素内的多个字段集中获取输入字段(包括选择、文本区域)的所有值?

jquery 插件 - WordPress 菜单创建器

javascript - ng 重复和按钮集

jquery - 让服务器代码在处理时继续将数据发送回浏览器

javascript - 通过 XMLHttpRequest 转换日期

jquery-ui - jquery嵌套li点击事件多次调用