简体   繁体   English

为什么.popup('open')在jQuery Mobile中不起作用?

[英]why .popup('open') is not working in jquery Mobile?

I am opening a pop up screen on anchor tag I don't know why it is not open. 我正在锚标签上打开一个弹出屏幕,但我不知道为什么它没有打开。 I used many time this line to open the pop up. 我花了很多时间在这行中打开弹出窗口。 It always open. 它总是打开。 But this time it is not when I inspect it show 'display none' with no content. 但是这次不是我检查时显示“不显示任何内容”。

I follow the steps 我按照步骤

  1. Press add button (generate row) 按添加按钮(生成行)
  2. Click icon on the row (right side). 单击行(右侧)上的图标。 Show pop up screen with edit and delete option. 显示带有编辑和删除选项的弹出屏幕。
  3. Press edit. 按编辑。 It should show pop up screen, but it is not showing... 它应该显示弹出屏幕,但不显示...

http://jsfiddle.net/4ajeB/11/ http://jsfiddle.net/4ajeB/11/

$('.edit_h').click(function(){

    alert("edit ID:"+$(this).data('originalId'));
    $("#editTestCaseId").popup("open");

})

This may not be a solution, but it is certainly a workaround. 这可能不是解决方案,但肯定是一种解决方法。

After tracing the CSS and finding that jQuery was probably just being too greedy with its class adding/removing logic, I decided to try the popup("open", ...) call manually using the console. 在跟踪CSS并发现jQuery可能对其类的添加/删除逻辑过于贪婪之后,我决定尝试使用控制台手动尝试popup("open", ...)调用。 As it turns out, it works fine when done that way. 事实证明,通过这种方式可以正常工作。 I tried putting the call in the code in different places and in multiples to no avail. 我尝试将调用放在代码中的不同位置并以倍数进行都无济于事。 As it turns out, other people have run into the same problem. 事实证明,其他人也遇到了同样的问题。 The workaround posted here seems to do the trick: 此处发布的解决方法似乎可以解决问题:

setTimeout(function () {
    $("#editTestCaseId").popup("open");
}, 100);

Why this has to be done? 为什么必须这样做? I have no idea. 我不知道。

JSFiddle: http://jsfiddle.net/4ajeB/12/ JSFiddle: http : //jsfiddle.net/4ajeB/12/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM