如何更改或添加 class 的 jquery 移动加载器小部件?
How to change or add class of jquery mobile loader widget?
基于此处的文档:http://api.jquerymobile.com/loader/#option-classes
有一种方法可以更改或添加 ui-loader
(加载程序小部件的默认 class)。
不过我已经试过了,但不知怎么的,它并没有改变任何东西。这是我的演示:
https://jsfiddle.net/yusrilmaulidanraji/u1q4xjnt/4/
有什么想念的吗?
不知何故,我已经尝试了其文档中的所有示例,但 类 选项仍然不会执行任何操作。因此,我最终通过 js 以编程方式更改它。这是我的演示:https://jsfiddle.net/yusrilmaulidanraji/u1q4xjnt/6/
Html:
<button id="hideLoading"></button>
Css:
.abv-loading-text{
width: 100%;
text-align: center;
}
.ui-loader-custom {
display: block;
width: 100%;
left: 0;
margin: 0 auto;
}
Js:
var loadingUI =
"<label class='abv-loading-text'>Wait on this screen until the process is complete.</label>" +
"<span class='ui-icon-loading'></span>" +
"<h1></h1>";
$.mobile.loading("show", {
html: loadingUI,
textVisible: true
});
$(".ui-loader").addClass('ui-loader-custom');
$("#hideLoading").on("click", function () {
$(".ui-loader").removeClass('ui-loader-custom');
$.mobile.loading("hide");
});
基于此处的文档:http://api.jquerymobile.com/loader/#option-classes
有一种方法可以更改或添加 ui-loader
(加载程序小部件的默认 class)。
不过我已经试过了,但不知怎么的,它并没有改变任何东西。这是我的演示: https://jsfiddle.net/yusrilmaulidanraji/u1q4xjnt/4/
有什么想念的吗?
不知何故,我已经尝试了其文档中的所有示例,但 类 选项仍然不会执行任何操作。因此,我最终通过 js 以编程方式更改它。这是我的演示:https://jsfiddle.net/yusrilmaulidanraji/u1q4xjnt/6/
Html:
<button id="hideLoading"></button>
Css:
.abv-loading-text{
width: 100%;
text-align: center;
}
.ui-loader-custom {
display: block;
width: 100%;
left: 0;
margin: 0 auto;
}
Js:
var loadingUI =
"<label class='abv-loading-text'>Wait on this screen until the process is complete.</label>" +
"<span class='ui-icon-loading'></span>" +
"<h1></h1>";
$.mobile.loading("show", {
html: loadingUI,
textVisible: true
});
$(".ui-loader").addClass('ui-loader-custom');
$("#hideLoading").on("click", function () {
$(".ui-loader").removeClass('ui-loader-custom');
$.mobile.loading("hide");
});