my code structure is like this
I think after on load, besides fadeOut, the js function on
also stops and stop running.
how can this be written?
Update
$(document).ready(function () {
$(".pageloading").show();
var curIndex=0;
var timeInterval=90;
var arr = new Array();
arr[0]="images/ja/XY0001.png";
arr[1]="images/ja/XY0002.png";
arr[2]="images/ja/XY0003.png";
arr[3]="images/ja/XY0004.png";
arr[4]="images/ja/XY0005.png";
arr[5]="images/ja/XY0006.png";
arr[6]="images/ja/XY0007.png";
arr[7]="images/ja/XY0008.png";
var timer = setInterval(changeImg,timeInterval);
function changeImg(){
var obj=document.getElementById("obj");
if(curIndex==arr.length-1){
curIndex=0;
}else{
curIndex+=1;
}
obj.src=arr[curIndex];
return changeImg();
}
});
$(window).on("load", function(){
$(".pageloading").fadeOut();
window.clearInterval(timer);
});
do I have the right code
or am I weird
and he doesn"t seem to be running in sequence?