W
Webmaster
The following style sets the opacity or semi-transparency in Mozilla and
Explorer browsers for an image:
#myImage{
filter: alpha(opacity=50); -moz-opacity:0.50; opacity: 0.50;
}
<img src="someimage.jpg" name="myImage" id="myImage">
The alpha(opacity=50 does it in IE and the opacity: 0.50 does it Mozilla.
I'm not sure what purpose -moz-opacity:0.50 serves, as it seems to work
without that, at least on the version Mozilla 1.7.6 I've tested it on.
Naturally it is possible to change a background image by for example:
document.getElementById("myImage").style.background="url(anotherimage.jpg)";
Or a normal image:
document.images.myImage.src='anotherimage.jpg';
Is it possible to gradually replace one image with another by use of opacity
in stages (timeouts), achieve the effect of a typical Flash animation
fade-in fade-out animation, replacing the need of Flash for that. Perhaps
it can be done by combining background and foreground images by timeouts?
The alpha/opacity is as far as I know proprietary IE and Mozilla
non-standard CSS methods, so in any case it couldn't work on all browsers.
Any ideas if and how this could be done would be much appreciated.
Thanks
Explorer browsers for an image:
#myImage{
filter: alpha(opacity=50); -moz-opacity:0.50; opacity: 0.50;
}
<img src="someimage.jpg" name="myImage" id="myImage">
The alpha(opacity=50 does it in IE and the opacity: 0.50 does it Mozilla.
I'm not sure what purpose -moz-opacity:0.50 serves, as it seems to work
without that, at least on the version Mozilla 1.7.6 I've tested it on.
Naturally it is possible to change a background image by for example:
document.getElementById("myImage").style.background="url(anotherimage.jpg)";
Or a normal image:
document.images.myImage.src='anotherimage.jpg';
Is it possible to gradually replace one image with another by use of opacity
in stages (timeouts), achieve the effect of a typical Flash animation
fade-in fade-out animation, replacing the need of Flash for that. Perhaps
it can be done by combining background and foreground images by timeouts?
The alpha/opacity is as far as I know proprietary IE and Mozilla
non-standard CSS methods, so in any case it couldn't work on all browsers.
Any ideas if and how this could be done would be much appreciated.
Thanks