当我在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> 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>
答案 0 :(得分:0)
而不是$(文件).ready ..使用此
$(document).bind('pageinit', function() {
$("#intro_view").popup('open');
});
请参阅jquery docs http://jquerymobile.com/demos/1.2.1/docs/api/events.html