jagguy
asked on
jqery function wont work
Hi, Why cant the following jquery work when I place the code in a separate function as below
I get no error but no animation.
I get no error but no animation.
$(document).ready(function(){
var $val1=6;
var $val2=10.3;
var img = ["images/bcave1.png", "images/bcave2.png"];
var indexNum=0;
setInterval("animatepic1()",100);
/* var gameLoop = setInterval( function(){
$("#pic").attr("src", img[indexNum]);
indexNum++;
if (indexNum >= 2) {indexNum = 0;}
} , 100);
*/
});
function animatepic1(){
$("#pic").attr("src", img[indexNum]);
indexNum++;
if (indexNum >= 2) {indexNum = 0;}
}
.....
<img id ="pic" src="images/bcave1.png" alt="eight ball" />
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.