我想添加一个加载器但是我的加载器在页面加载后出现。我在过渡期间需要它。我为你理解我的问题做了一点涂鸦
http://jsfiddle.net/Zr7Gf/382/
HTML:
<body>
<div data-role="page" id="index">
<div data-theme="a" data-role="header">
<h3>
First Page
</h3>
<a href="#second" >Next</a>
</div>
<div data-role="content">
hiii
</div>
<div data-theme="a" data-role="footer" data-position="fixed">
</div>
</div>
<div data-role="page" id="second">
<div data-theme="a" data-role="header">
<h3>
Second Page
</h3>
<a href="#index" class="ui-btn-left">Back</a>
</div>
<div data-role="content">
</div>
<div data-theme="a" data-role="footer" data-position="fixed">
</div>
</div>
</body>
JS:
$(document).on('pagebeforecreate', '[data-role="page"]', function(){
setTimeout(function(){
$.mobile.loading('show');
},1);
});
$(document).on('pageshow', '[data-role="page"]', function(){
setTimeout(function(){
$.mobile.loading('hide');
},300);
});
任何提示?
编辑: 如果你对jsfiddle进行了编辑,让我们所有人更好地想象它,我会很喜欢它!但它最终的愿望!
答案 0 :(得分:0)
直接在JS上直接运行JS
setTimeout(function(){
$.mobile.loading('show');
},1);
并等待隐藏直到完全加载的文件
$(document).ready(function(){
setTimeout(function(){
$.mobile.loading('hide');
},300);
});
请参阅此Fiddle