我正在尝试从jquery移动选择菜单中打开一个弹出对话框。如果我将弹出窗口命令设置为超时,则可以正常工作,但不能直接打开弹出窗口。即:
这有效:
$("#message-commands").bind("change", function (event, ui) {
var value = event.target.value;
switch (value) {
case "delete":
setTimeout(function () {
$('#popupDelete').popup('open');
}, 1000);
break;
}
但这不是:
$("#message-commands").bind("change", function (event, ui) {
var value = event.target.value;
switch (value) {
case "delete":
$('#popupDelete').popup('open');
break;
}
popupDelete div看起来像这样
<div data-role="popup" id="popupDelete" style="max-width:300px;" class="ui-corner-all ui-popup ui-body-c ui-overlay-shadow" aria-disabled="false" data-disabled="false" data-shadow="true" data-corners="true" data-transition="none" data-position-to="origin">
<div data-role="header" class="ui-corner-top ui-header ui-bar-a" role="banner">
<h1 class="ui-title" role="heading" aria-level="1">Delete?</h1>
</div>
<div data-role="content" data-theme="d" class="ui-corner-bottom ui-content ui-body-d" role="main">
<h3 class="ui-title">Are you sure you want to delete this message?</h3>
<p>This action cannot be undone.</p> <a href="#" data-role="button" data-inline="true" data-rel="back" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" class="ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-up-c"><span class="ui-btn-inner ui-btn-corner-all" onclick="$('#deleteConfirm').popup('close');"><span class="ui-btn-text">Cancel</span></span></a> <a href="#" data-role="button" data-inline="true" data-rel="back" data-transition="flow" data-theme="b" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" class="ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-up-b" onclick="deleteConfirmed();"><span class="ui-btn-inner ui-btn-corner-all"><span class="ui-btn-text">Delete</span></span></a>
</div>
</div>
有什么建议吗?我不能使用上面的,因为如果客户端处理命令的速度很慢,它将无法在1000毫秒内工作,我不想增加它以便为更快的客户端做出不合理的延迟。我怀疑问题是选择菜单必须先关闭然后才能打开弹出窗口,但是没有事件可以检测选择菜单是否已关闭。