use*_*ser 13 javascript android jquery-mobile cordova
我尝试在我的应用程序中显示活动指示器.我activity.js
用于活动指标.那个在浏览器和iPhone上工作得很好但是它不适用于Android设备.
我不知道为什么指标在Android设备中不起作用.
以下是我的活动指标示例代码:
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;
}
Run Code Online (Sandbox Code Playgroud)
小智 1
我使用下面的代码来显示 Android 上的本机活动指示器..试试这个..它可能会有所帮助..
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
$(document).bind("ajaxSend", function() {
navigator.notification.activityStart("App Name","Loading...");
}).bind("ajaxStop", function() {
navigator.notification.activityStop();
}).bind("ajaxError", function() {
navigator.notification.activityStop();
});
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1118 次 |
最近记录: |