Jquery Dialog无法正常工作 [英] Jquery Dialog not working
问题描述
您好,
我的对话框无效。当我点击按钮时,没有任何反应。这是我正在使用的代码
Hello ,
My Dialog is not working. when i click on button, nothing happens.THis is the code that i am using
function openPop(url, divClass, title, width, height,btnOk) {
var b = [];
if (btnOk) {
b = [
{
text: "OK",
click: function () { jQuery("." + divClass).dialog('destroy'); }
}
];
}
var ifr = jQuery("." + divClass).find('iframe');
jQuery("." + divClass).dialog({
modal: true,
autoOpen: true,
title: title,
width: width,
height: height,
resizable: false,
position: {
my: "center",
at: "center",
of: window,
within: window
},
buttons: b,
open: function () {
setTimeout(function () {
jQuery(ifr).attr('src', url);
}, 10);
},
close: function () {
jQuery(ifr).attr('src', 'about:blank');
jQuery(this).dialog('destroy');
}
});
}
这就是我调用此函数的方法< br $>
this is how i call this function
$(".btn").click(function () {
openPop('<%= Request.ApplicationPath%>/StoreManagement/AddNew.aspx', 'divPop', 'Add New Store', 650, 550);
return false;
});
每当我点击按钮页面模糊片刻然后返回原始状态。这段代码适用于jquery 1.6.something。现在我正在尝试使用它与jquery 2.1.something但不在这里工作。
whenever i click the button only page blurs for a moment and then returns to it's original state. This code works fine with jquery 1.6.something. now i am trying to use it with jquery 2.1.something but not working here.
推荐答案
(。btn)。click(function(){
openPop('<%= Request.ApplicationPath%> /StoreManagement/AddNew.aspx','divPop','Add New Store',650,550);
return false;
}) ;
(".btn").click(function () { openPop('<%= Request.ApplicationPath%>/StoreManagement/AddNew.aspx', 'divPop', 'Add New Store', 650, 550); return false; });
每当我点击按钮页面模糊片刻然后返回原始状态。这段代码适用于jquery 1.6.something。现在我正在尝试使用它与jquery 2.1.something但不在这里工作。
whenever i click the button only page blurs for a moment and then returns to it's original state. This code works fine with jquery 1.6.something. now i am trying to use it with jquery 2.1.something but not working here.
确保包含最新的jquery-ui
此外,函数名称是openPopUp,但点击是调用openPop
Make sure to include the latest jquery-ui
Also, the function name is openPopUp but the click is calling openPop
<script type="text/javascript" src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.11.4/themes/ui-lightness/jquery-ui.css">
以下是演示:
jQuery Dialog - JSFiddle [ ^ ]
这篇关于Jquery Dialog无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!