• Register
Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.
0 votes
Google ads have a limit of 30 seconds of animation so I just want the animation to loop twice, not indefinitely.

Do I need javascript to do this? Can you help with this?

Thank you.
asked in how_to by (160 points)
    
In InDesign's Timing panel, instead of choosing Loop, set the "Play" amount to 2.
I already have several groups of linked animations in the timing panel, so that feature doesn't work for what I need it to do.

The entire animation sequence needs to play twice, not just separate animation links playing twice.

1 Answer

+1 vote
 
Best answer

There isn't a built-in way to loop an entire sequence 2x.

You could automatically replay the page after a certain amount of time (e.g. 15 secs) and have it happen only once.

Attach the following code as a .js file in the Resources section of the in5 dialog (how to attach resources):

setTimeout( function(){ nav.to(1); }, 15000 );

The nav.to function will restart the first page. The 15000 is in milleseconds (a thousandth of a sec). The setTimeout is a timer function that will only run once.

answered by (179k points)
selected by
Thanks, Justin!

The above code didn't work for me, but I was able to google search your idea of reloading the page and found one that did:

setTimeout(function () {
    if(window.location.hash != '#r') {
        window.location.hash = 'r';
        window.location.reload(1);
    }
}, 15000);