Saturday, June 11, 2011

jQuery Image RollOver

<br />$(function() {<br /> $('img[data-hover]').hover(function() {<br /> $(this).attr('tmp', $(this).attr('src')).attr('src', $(this).attr('data-hover')).attr('data-hover', $(this).attr('tmp')).removeAttr('tmp');<br /> }).each(function() {<br /> $('<img />').attr('src', $(this).attr('data-hover'));<br /> });;<br />});<br />
<br /><img data-hover="second.gif" src="first.gif" /><br />

No comments:

Post a Comment