gpt4 book ai didi

javascript - Jquery mobile 在刷新时出错,但在最初打开文件时不会出错

转载 作者:行者123 更新时间:2023-11-28 08:56:03 25 4
gpt4 key购买 nike

当我在 Chrome 中打开文件时,它可以正常工作,但刷新页面会出现错误。我已经检查过我没有将相同的来源列出两次。如果你问我的话,我会觉得很奇怪!

这是我收到的错误:

未捕获错误:在初始化之前无法调用弹出窗口上的方法;尝试调用方法“open”

<div data-role="page" id="page1">
<div data-role="header">
<h1>jQuery Mobile Example</h1>
</div>
<div data-role="content">
<div data-role="popup" id="intro_view" data-overlay-theme="a" data-theme="a" style="max-width:100%;">
<div data-role="header" data-theme="a" class="ui-corner-top ui-header ui-bar-a" role="banner">
<h1 class="ui-title" role="heading" aria-level="1">Welcome!</h1>
</div>

<div data-role="content" data-theme="d" class="ui-corner-bottom ui-content ui-body-d" role="main">
<h1 class="ui-title">Navigate through time and space to see what's happening around you!</h1>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Here's a few quick tips to get you started:</p>
<ol>
<a href="#" data-role="button" data-inline="true" data-rel="back" data-theme="c" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" class="ui-btn ui-btn-up-c ui-shadow ui-btn-corner-all ui-btn-inline"><span class="ui-btn-inner"><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-btn-up-b ui-shadow ui-btn-corner-all ui-btn-inline"><span class="ui-btn-inner"><span class="ui-btn-text">Delete</span></span></a>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$( "#intro_view" ).popup( "open",{positionTo:"window"} );
});
</script>

最佳答案

代替 $(document).ready .. 使用这个

$(document).bind('pageinit', function() {
$("#intro_view").popup('open');

});

请引用jquery文档http://jquerymobile.com/demos/1.2.1/docs/api/events.html

关于javascript - Jquery mobile 在刷新时出错,但在最初打开文件时不会出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18477463/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com