Question

I am using jQuery Rotating Elements and it is doing exactly what I'm looking for aside from the fact that the user must click in order for the boxes to rotate. I would like for the boxes to automatically rotate clockwise every x seconds. I'm not going to copy all of the code as it can easily be downloaded for free on the link above and you may see it applied to my site here.

Inside the jquery.aperture.js file I see

    triggerRotation : function($imgBox, $rsRow) {
        $('body')
        .on('click touchstart', '#aperture-rotate-cw:not(.anim-running)', function() {
            var $trigger = $(this);
            $trigger.addClass('anim-running');

            $imgBox
            .stop(true, true)
            .each(function(i) {
                var $thisIb = $(this),
                    leftTo = $thisIb.attr('data-cw-left-to'),
                    topTo = $thisIb.attr('data-cw-top-to');

                $thisIb
                .animate({
                    left : leftTo,
                    top : topTo,
                }, methods.settings.duration, methods.settings.easing, function() {
                });
            })
            .promise()
            .done(function() {
                methods.setTargetPosition($rsRow);
                $trigger.removeClass('anim-running');
            });
        });

And I feel like if it was .on('load') instead of .on('click touchstart') I may be in the correct section but I honestly don't know what I need to change to make this happen the way I'd like it to.

Your help is appreciated and I'd be happy to provide additional details if needed.

Was it helpful?

Solution

You have to use the setTimeout function like so:

setTimeout(function() {

      // Call your rotating function

}, desiredTimeInMilliseconds);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top