I am just starting out learning some HTML and javascript (read: I know practically nothing about this stuff) and would like to have my index.html page open a rotating image
Here is how I set up the function. I added the count because when loading a gallery the onStart/onComplete calls will fire everytime a new image loads. I only want the first call to bind the setInterval to the next call.
function toggleRotating(fromButton) {
count = count + 1;
if (fromButton == false) {
clearInterval(rotatingInterval);
rotatingInterval = false;
count = 0;
} else {
if(count == 1)
rotatingInterval = setInterval($.fancybox.next, 10000);
}
}
And here's my global vars and method of launching fancybox.
var rotatingInterval = false;
var count = 0;
$(function () {
$("a.slide").attr('rel', 'presentation1').fancybox({'autoDimensions':false,'height':540,'width':720,'autoScale':false,'cyclic':true, 'onStart': function(){ toggleRotating(true); } });
});
I didn't create a button to stop rotating. I think I will make it so if you click on the next or prev buttons it will toggleRotating to false.