[英]Can't programmatically open up a jQuery Mobile PopUp
I am trying to open up a jQuery Mobile popup. 我正在尝试打开jQuery Mobile弹出窗口。
Here's what I have: 这是我所拥有的:
<div data-role="popup" class="ui-content" id="popupSave">
<p>Comment saved.</p>
</div>
And later on in some code, which gets executed, I have this: 后来在执行的一些代码中,我有这个:
$('#popupSave').popup("open");
So why is my popup not... well, popping up? 那么为什么我的弹出窗口不...好吧,弹出窗口呢?
try this 尝试这个
$('#popupSave').popup();
$('#popupSave').popup('open');
example: https://jsfiddle.net/mohamed_badr/fy2quhzd/1/ 例如: https : //jsfiddle.net/mohamed_badr/fy2quhzd/1/
Found the actual solution. 找到了实际的解决方案。
setTimeout( function(){ $( '#popupSave' ).popup( 'open' ) }, 1 );
I'm guessing there's an error with Chrome like there is for other jQuery events. 我猜想Chrome和其他jQuery事件一样都有错误。
I'll try to add it to my answer later on when I find out what it is - I had another issue like this with showing a mobile spinner. 我稍后会在找到答案时尝试将其添加到我的答案中-显示移动微调框遇到了另一个类似问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.