From September, Flash will no longer be supported by Chrome. Prepare for the shift towards HTML5 by visiting our Flash to HTML5 help page

Check it out!

AdQuestions

7
comments
981
views

How to check if banner is visible

Hello, I've made some HTML5 banners with an animation in it. Is it possible to start this animation when the banner is in view? I have tried it with the getState function, but that also gives 'visible' back when the banner isn't visible in my viewport. This is my code; [code]var state = dhtml.getState(); if (state === 'visible') { _function(); } else { dhtml.sharedEvents.on('changed:state', function (s) { if (s === 'visible') { _function(); } }); }[/code] Thnx for the help.

Comments (7)
comments powered by Disqus