How do I delay a .gif image until the user scrolls down to it?

7,614

Solution 1

The name of the feature that you are looking for is called "lazy load". The technique typically works by initially showing a 1x1 transparent placeholder, and then using JavaScript to swap it out for the real image on scroll.

Here are some sites that provide code to do this for you:

For this to work, you must be able to alter the forum software to include the required javascript in the page. You won't be able to do this all within a forum post.

Solution 2

Consider using Discourse instead, it's free, open-source and superior to myBB in so many ways. Most importantly it supports lazy-loading. The Discourse project is headed up by Jeff Atwood one of the founders of the Stack Exchange network.

Share:
7,614

Related videos on Youtube

Stephen Ostermiller
Author by

Stephen Ostermiller

Updated on September 18, 2022

Comments

  • Stephen Ostermiller
    Stephen Ostermiller over 1 year

    I have multiple .gif files that I want to post on a forum, it's powered by myBB. Anyways, I want these to load sequentially as the user scrolls. E.g first .gif loads, user scrolls down, second .gif loads. I've been searching for days and I still can not get it. Thanks

    • Admin
      Admin over 10 years
      Please let us know why you want to do this - reason being their's a difference between loading an element and delaying a element, or hiding a element..... As you can animate the element when visible but the element could of loaded prior to user scrolling down for example.