我尝试在我的应用程序中显示活动指示器。 我正在使用activity.js
作为活动指示器。它在浏览器和iPhone上运行良好,但在安卓设备上无法工作。
我不知道为什么指示器在安卓设备上无法工作。
这是我用于活动指示器的示例代码:
function showIndicator() {
console.log("inside show indicator");
applyOverLay();
var showIndicator = document.createElement("div");
showIndicator.setAttribute("class", "activity-indicator");
document.body.appendChild(showIndicator);
$('.activity-indicator').activity({
width: 5,
space: 1,
length: 3,
color: '#fff'
});
}
function applyOverLay() {
var overlay = document.createElement("div");
overlay.setAttribute("id", "overlayAttr");
overlay.setAttribute("class", "overlay");
document.body.appendChild(overlay);
}
function hideindicator() {
$('.activity-indicator').activity(false);
setTimeout(function() { $(".activity-indicator").empty().remove(); }, 0);
setTimeout(function() { $(".overlay").empty().remove(); }, 0);
}
function loadhtmlpage() {
//location.href='#refillReminder';
$.mobile.changePage("#refillReminder");
showIndicator();
hideindicator();
}
style.css:
.activity-indicator {
padding: 10px;
position: absolute;
top: 50%;
left: 45%;
z-index: 1001;
}