Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7534815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:07:39+00:00 2026-05-30T06:07:39+00:00

I am playing with a new website I created a few days ago. The

  • 0

I am playing with a new website I created a few days ago.
The site contains lots and lots of gifs there is displayed on the frontpage. As of right now, a static .png thumbnail is showed and when hovered, it displays the gif instead.

This is pretty much what I want. However, as of now, the site preloads every single gif on the page, which takes a long time and a lot traffic is wasted. If there are 50 gifs on the frontpage and every gif is 2mb, that’s 100mb traffic per user.
Isn’t it possible to only load every png, then load the gif if it’s hovered? I know it won’t play smooth the first time, but I don’t have a whole lot of web traffic on my web hotel.

Is this possible with either some PHP or good-old JavaScript?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:07:40+00:00Added an answer on May 30, 2026 at 6:07 am

    Change the URL of the image with hover. In this case with jQuery

    $('#my_image').hover(function(){
        $('#my_image').attr('src','my.gif');
    });
    

    Want to make it dynamic without having to set it per image? Add the HTML5 Data element:

    <img src="my.png" data-gif="my.gif" />
    

    And with JavaScript:

    $('img').hover(function(){
        $(this).attr('src',$(this).data('gif'));
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a few flash errors on my website. I started playing around with
We've been working on a new website and there is some mystery padding/margin occurring
Playing with the new(ish) url rewriting functionality for web forms, but I'm running into
Completely new to java and I have been playing around with regex in a
I am new to ruby and am playing around with the gem to access
I'm new to Android development and was playing around with the camera. I just
I'm playing a little bit with the new StackOverflow API . Unfortunately, my JSON
I was playing around with the new CSS3 transitions and I seem to have
i'm new with Android and i've been playing with it a bit in the
Completely new to most of this stuff, but basically Im playing around with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.