/ Published in: JavaScript
URL: http://davidwalsh.name/sugar/mootools/page/3
Expand |
Embed | Plain Text
window.addEvent('domready', function() { $$('img.mo').each(function(img) { var src = img.getProperty('src'); var extension = src.substring(src.lastIndexOf('.'),src.length) img.addEvent('mouseenter', function() { img.setProperty('src',src.replace(extension,'-mo' + extension)); }); img.addEvent('mouseleave', function() { img.setProperty('src',src); }); }); }); //Usage: <a href="/"><img src="/graphics/sugar.jpg" alt="Sugar" class="mo" height="50" width="150"></a>
Comments
Subscribe to comments
You need to login to post a comment.

Usage:
[code][/code]
The correct URL to the original is http://davidwalsh.name/mootools-image-mouseovers to maybe save someone some time.
Thanks for sharing this though!