$("#clickMe").click(
function(){
if (i == 1) {
i = i+1
$("#div p").css("left", "-" + width * i + "px");
}
});
As you can see -margin changes when somebody clicks a button. What if I want it to happen just on site load every 10 seconds?
Thanks.
Use setInterval
to set up a timed event:
setInterval(
function(){
if (i == 1) {
i = i+1
$("#div p").css("left", "-" + width * i + "px");
}
},
10000 /* 10000 ms = 10 sec */
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With