
If you are viewing this post in Firefox, then you will be able to see variations of the same picture of me (above) with different opacity levels (visibility levels). For the first picture, opacity level is set to 0.1, and for the second 0.3, then 0.5, 0.7 and finally to 1. This is a great feature in Firefox where you can change the opacity of any image on the fly, just by inserting style=”-moz-opacity:0.5″ in any image code (IMG src).
Example: <img src="photo.jpg" style="-moz-opacity:0.7" />
You can change the opacity level from 0.7 to any number between 0 (totally not visible) to 1 (fully visible). Choose anything in between from 0.1 to 0.9 for displaying the image in partial visibility.
How about MouseOver effect?
That is possible too… mouse over to the picture (left) to see what I mean. This effect can also be done on the fly, by adding additional code to the IMG code of any image. Code to be added is onMouseover="this.style.MozOpacity=1" onMouseout="this.style.MozOpacity=0.6". Again, you can set any number between 0 to 1. In this code 1 is the mouse over opacity level of the image and 0.6 is the mouse-out opacity level (when you remove your mouse from the image).
Example: <IMG style="-moz-opacity:0.6" src="photo.jpg" onMouseover="this.style.MozOpacity=1" onMouseout="this.style.MozOpacity=0.6">
So, in this code above, there are three opacity levels:
- For the initial state
- Mouse-over state
- Mouse-out state
Usage Suggestion
You can use this effect on some ads, banners, and images where you do not want your readers to be distracted by them. Using this effect will still allow them to view the images in 100% opacity by just mouse-overing on them.
Too bad it does not work on other browsers. There are many cross-browser javascripts for doing these kind of effects. But usually they require you some sort of installation (uploading additional css, js files..etc). But this one doesn’t! And that is the best thing about it.