[英]I can't understand why cordova link and Javascript coding is not working
Below is my cordova link which I've added in my HTML code but it's not working. 以下是我在我的HTML代码中添加的cordova链接,但它不起作用。
<script type="text/javascript" src="cordova.js"></script>
I've added some Javascript below but I can't understand how to apply it. 我在下面添加了一些Javascript,但我不明白如何应用它。
$(function(){
var slideIndex = 1;
showDivs(slideIndex);
function plusDivs(n) {
showDivs(slideIndex += n);
}
function showDivs(n) {
var i;
var x = document.getElementsByClassName("mySlides");
if (n > x.length) {slideIndex = 1}
if (n < 1) {slideIndex = x.length}
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
x[slideIndex-1].style.display = "block";
}
});
Can someone help me out please? 有人可以帮我吗?
If you are creating apache cordova app you should wait until device ready. 如果要创建apache cordova应用,则应等待设备准备就绪。 Therefore you have to use like this code block. 因此,您必须使用像这样的代码块。
Index.js Index.js
(function () {
"use strict";
document.addEventListener( 'deviceready', onDeviceReady.bind( this ), false );
function onDeviceReady() {
alert("I'm Ready!");
//You can call codes here
}
})(); })();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.