gpt4 book ai didi

jquerymobile加载消息主题

转载 作者:行者123 更新时间:2023-12-03 22:49:01 26 4
gpt4 key购买 nike

我对 jQuery Mobile 上的加载消息有疑问。

默认情况下,加载消息主题是a,根据jQuery Mobile代码:

<div class="ui-loader ui-body-a ui-corner-all" style="top: 204.5px; ">...</div>

我想知道如何更改此 div 的默认主题,我不知道。

提前致谢。

最佳答案

旧版本的答案,请参阅下面的 jQuery Mobile 1.1.0+

我不知道您可以在 mobileinit 事件处理程序中设置变量,但您可以在文档准备好时更改主题类:

//run the code on `document.ready`
jQuery(function ($) {

//find the loader div and change its theme from `a` to `e`
$('.ui-loader').removeClass('ui-body-a').addClass('ui-body-e');
});

这是上述解决方案的jsfiddle(您可以从按钮列表中更改加载对话框的主题):http://jsfiddle.net/jasper/eqxN9/1/

更新

jQuery Mobile 1.1.0 添加了对此的一些支持,您可以设置一些默认值:

loadingMessage string, default: "loading" Set the text that appears when a page is loading. If set to false, the message will not appear at all.

loadingMessageTextVisible boolean, default: false Whether the text should be visible when a loading message is shown. The text is always visible for loading errors.

loadingMessageTheme string, default: "a" The theme that the loading message box uses when text is visible.

来源:http://jquerymobile.com/demos/1.1.0/docs/api/globalconfig.html

请注意,由于新的加载程序设计,您必须将 loadingMessageTextVisible 设置为 true 加载程序主题覆盖才能正常工作。如果您没有设置消息,则没有背景可以更改颜色...

这是一个演示:http://jsfiddle.net/vHJnd/

快速浏览文档表明您现在也可以即时执行此操作:

$.mobile.showPageLoadingMsg("a", 'loading message');

您可以将这些参数添加到 showPageLoadingMsg() 函数中以强制显示主题和消息。这是设置默认值的替代方法。

这是一个演示:http://jsfiddle.net/vHJnd/1/

关于jquerymobile加载消息主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8245360/

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