本文介绍了页面加载小部件中的JQuery Mobile自定义HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何为JQuery Mobile Web应用程序使用用于页面加载小部件的自定义HTML?
How to have a custom HTML for Page Loading Widget for JQuery Mobile web app?
我尝试了以下操作:
$(document).on('mobileinit', function(){
$.mobile.loader.prototype.options.html = "<span class='ui-bar ui-overlay-c ui-corner-all'><img src='/image/logo.png' /><h2>loading...</h2></span>";
});
但是它仍然显示默认图像.我想要一个全局配置.
But it still displays the default image. I want to have a global configuration.
推荐答案
在单个页面中
此处提供的加载器的文档.另外,请查看此与您非常相关的文档.
In single page
Documentation for the loader available here. Also check out this documentation much relevant to you.
您应该执行以下操作
$(document).ready(function() {
$.mobile.loading('show', {
text: 'foo',
textVisible: true,
theme: 'z',
html: "<span class='ui-bar ui-overlay-c ui-corner-all'><img src='http://www.shougun.it/images/loading.gif' /><h2>loading...</h2></span>"
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" rel="stylesheet" />
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<div data-role="page">
<div data-role="header">
<h1>header</h1>
</div>
</div>
它必须进入<script src=jquery.js>
,但要在<script src=jquerymobile.js>
之前,并且必须在mobileinit
事件上调用.您在加载jQuery Mobile js之前导入了js吗?
It needs to go belog <script src=jquery.js>
but before <script src=jquerymobile.js>
and must be called onmobileinit
event. Did you import the js before loading the jQuery Mobile js?
这篇关于页面加载小部件中的JQuery Mobile自定义HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!