So, I am trying to get these images on the sidebar of the page I am creating, which are static, but when you hover over the mouse, they animate like gifs. My current setup is for the background-image css property background-image be static jpg, but change to an animated gif on hover. Here is the code to illustrate my point better.
CSS
#segments li a.fnb { background-image: url(http://dl.dropbox.com/u/8808984/2.0/SegmentThumbs/fnb%21-small.jpg); } #segments li a.whhu { background-image: url(http://dl.dropbox.com/u/8808984/2.0/SegmentThumbs/still.jpg); } #segments li a.fnb:hover { background-image: url(http://dl.dropbox.com/u/8808984/2.0/SegmentThumbs/549933.gif); } #segments li a.whhu:hover { background-image: url(http://dl.dropbox.com/u/8808984/2.0/SegmentThumbs/549841.gif); }
I will relieve you of the rest, I do not have to express my point of view.
HTML:
<ul id="segments"> <li><a href="http://collabprojekt.com/tagged/fnb!" class="fnb"></a></li> <li><a href="http://collabprojekt.com/tagged/whhu" class="whhu"></a></li> </ul>
Website http://tcptest.tumblr.com , check the left panel with images to see how it currently works.
This works, but my only problem is that for the first freeze ever, it must load the gif, and this causes a short moment when the field becomes empty when it loads the gif. Although this is not a huge deal, it looks really unprofessional.
I tried this idea ( link ) of using JS, but I failed.
So, I think, my question is: is there a better way to do this with CSS or even any other language so that I don't get this random empty moment?
source share