javascript - How to hold gif animation on website to play in specified section / anchor? -


i ask how hold animated gif start in specified section / anchor.

example goods : http://www.visaeurope.com/tokenisation/#

i create animated gif in vertical section describe work scheme, i'm affraid other gif (in bottom) started looping before visitor reach section.

thank in advanced :)

you test if gif element want animate visible on screen (depending on screen scroll)

here stackoverflow post show function detect if element visible on screen :

check if element visible after scrolling

here code :

function isscrolledintoview(elem) { var $elem = $(elem); var $window = $(window);  var docviewtop = $window.scrolltop(); var docviewbottom = docviewtop + $window.height();  var elemtop = $elem.offset().top; var elembottom = elemtop + $elem.height();  return ((elembottom <= docviewbottom) && (elemtop >= docviewtop)); } 

after that, listen on scroll event , if element visible, animate it.

hope helped, luck mate


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -