-1

I would like to ask how to hold the animated gif start in specified section / anchor.

Example Goods : http://www.visaeurope.com/tokenisation/#

I will create some animated gif in vertical section to describe my work scheme, I'm affraid the other gif (in bottom) will started looping before the visitor reach their section.

Thank you in advanced :)

  • This question doesn't seem to present a specific, reproducible issue that needs solving. Please read up on creating a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – benjarwar Aug 25 '15 at 04:03

1 Answers1

0

you could test if the gif element you want to animate is visible on the screen (depending on screen scroll)

Here is a stackoverflow post that show a function to detect if an element is visible on screen :

Check if element is visible after scrolling

Here is the 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, you could listen on scroll event and if the element is visible, just animate it.

Hope that helped, good luck mate

Community
  • 1
  • 1
segfault
  • 95
  • 7