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 6944963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:22:29+00:00 2026-05-27T13:22:29+00:00

Different to: Restart an animated GIF from JavaScript without reloading the image I have

  • 0

Different to: Restart an animated GIF from JavaScript without reloading the image

I have a simple animated gif icon which plays once (it does not repeat loop)

I have it inside a DIV. When the user mouse the mouse over the DIV I want to play the GIF. When they move out the DIV turns off. When the move back I want them to play the GIF again – can I use a force cache on jQuery:

HTML:

<div class="datebox magicbox_1" id="date_1">
  <img id="magicimage_1" class="magicimg" src="assets/img/dates/gifpicture.gif" alt=""/>
</div>

jQuery:

    $("#date_1").hover(function () {
        $("#magicimage_1").show();
    }, function () {
        $("#magicimage_1").hide();
    });

// thought about these
/*
var myImg = new Image();
myImg.src = "image.gif?rnd=" + Math.random();
img src="filename.gif?rand=<#?=rand(1,1000);?>" alt=""
*/ 
  • 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-27T13:22:30+00:00Added an answer on May 27, 2026 at 1:22 pm

    I updated the old code to show the images reset. It should be fast since it’s already cached.

    http://jsfiddle.net/gYmvN/4/

    So the new code would be:

    $("#date_1").hover(function () {
        //$("#magicimage_1").show();
        $("#magicimage_1").show().attr('src', 'assets/img/dates/1_randomhash-aefgh.gif?rnd=' +Math.random()+'');
    }, function () {
        //$("#magicimage_1").hide();
        $("#magicimage_1").hide().attr('src', '');
    });
    

    As I want to remove the SRC on hover out.. so it plays fully

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have some project, which can be running on databases with different names. I
different programming languages have different features or lack certain features. Design patterns are a
Do different browsers (Firefox/Safari/IE/Opera) have different limits on the length of the name attribute
Suppose you have 2 different ASP.NET applications in IIS. Also, you have some ASCX
I've tried two different methods of reusing code. I have a solution full of
I curious to how different people solve integration of systems. I have a feeling
There are so many different options coming out of microsoft for data access. Which
I have a Rails app representing a card game. There are several different types
Can a Java.exe JVM restart itself somehow? If you have a Java program running
I have a feeling that Apache is using a different php.ini file that 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.