473,322 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How to make an animated gif to play only when the mouse hovers over it?

YarrOfDoom
1,247 Expert 1GB
I guess the title says all. I don't care if it jumps back to frame one if you get your mouse off it.

Yarr
Jan 11 '08 #1
2 5075
garrow
32
You could use an anchor with a background image, and the :hover selector.
Example below.
Expand|Select|Wrap|Line Numbers
  1.  
  2. <html>
  3.     <head>
  4.         <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  5.         <title>GIFFY!</title>
  6.  
  7. <style type="text/css" media="screen">
  8.  
  9.     a#giffy             { background-image:url('img/static.gif'); width:30px; height:30px}
  10.     a#giffy:hover     { background-image:url('img/animated.gif'); }
  11.     a#giffy span     { visibility:hidden; }
  12. </style>
  13.     </head>
  14.     <body>
  15.  
  16.         <a id="giffy" href="#"><span>example</span></a>
  17.  
  18.     </body>
  19. </html>
  20.  
Jan 12 '08 #2
YarrOfDoom
1,247 Expert 1GB
My excuses to garrow for this late reply. For some reason it didn't appear in my subscriptions-list back then, and I had completely forgotten about it. I've used this code now, but it seems the height and width aren't doing anything. I want my images to be complete tough, and it's always nice if you don't have to do a workaround (inserting a transparent image with the desired dimensions in the span).
Mar 8 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jim S. | last post by:
when i try to insert an animated gif it would not run, just shows as a pic in the view mode, why? and how can i put an animated GIF so it plays when i run the database? thanks jim
2
by: Bubbles Van | last post by:
I'm trying to load an animated cursor resource directly from the exe file. I have added it in into the assembly and set it's build action to embedded resource. I have a function written as...
2
by: Paul van der Heu | last post by:
In an application I am writing I use both double click and mousedown, first for playing a track, second for doing a drag. Problem is that , unlike explorer, teh listview does not select the item...
4
by: Just Me | last post by:
I want to make a small window popup when the mouse hovers. I've looked in the Help but can't find any info (probably can't think of a good keyword) Are ToolTips control used for that? Any...
2
by: Scirious | last post by:
People, I need a way to detect the moment an animated GIF gets to it's end to switch to a different GIF. I can't use a Timer because the GIFs have different times and doing so (as I'm doing at the...
1
by: piter | last post by:
Hi. I have a button with an image which is animated gif. I need this animation to be played only when button_Click event occur. How to force form not to play animation until button is pressed? PK
7
by: Lemune | last post by:
Hi.. I am developing an application that connect to database on the other side of the net. And each time i want to connect to database and run some sql command, i want my user to know that there...
5
by: kimiraikkonen | last post by:
Hi, I couldn't find a necessary class which shows when mouse hovers on a link in Webbrowser control. Think of there's a status bar(text), when mouse comes on a link, the URL must be shown in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.