It's simple. I wanted an image for flashing the updates & news on my Website. I thought of using Marquee element, but was not able use image marquee, then thought of using animated image but don't know how to create it. Then thought of writing a javascript which will hide & show the image continuously based upon time out, what a trick!!!
I'm posting this for reference because I couldn't find any examples of how to animate an image and it either hidden or visible.
script type="text/javascript"
function toggle_visibility(hideorshow)
{
var e = document.getElementById("animatedicon");
if (hideorshow == 'hide')
{
if (e.style.visibility == 'visible')
{
Animate(1);
}
else
{
Animate(1);
}
}
else
{
if (e.style.visibility == 'visible')
{
Animate(1);
}
else
{
Animate(1);
}
}
}
function Animate(count)
{
var count = count
var e = document.getElementById("animatedicon");
e.style.visibility = ( e.style.visibility == 'visible' )? 'hidden' : 'visible';
if (count <= 0)
{
return;
}
else
{
setTimeout("Animate('" + count + "');", 500);
}
}
call onload="toggle_visibility('hide')" inside body element
inside html body write
img id="animatedicon" alt="animatedicon" src="sample image.JPG" style="visibility:hidden"
Outlook Addin does not work
16 years ago

2 comments:
why don't you use an animated gif?
I don't know how to create an animated gif, my requirement was just flashing an image to show the new updates & that can be done by showing & hiding the image. it's simple.
Post a Comment