I have noticed, that the usual way to do a image rollovers (for example different social network icons that change color when you hover your mouse over them) on Gavick (Joomla) sites is by using css classes made for each different icon. The icon image file itself is single and contains the main image and the hover one.
My question is - is this so to make it easier for everyone to use the predefined icons? For my own custom images (e.g. sponsor logos etc) that I want to have rollover - I would just use the mouseover and mouseout attributes.
Example:
- Code: Select all
<p><a href="http://www.example.com" target="_blank">
<img onmouseover="this.src='/images/version2_of_my_image.png';" onmouseout="this.src='/images/version1_of_my_image.png';" src="images/version1_of_my_image.png"/>
</a></p>
It works, but maybe it's bad practice to do so?
A.