Skip to content

Instantly share code, notes, and snippets.

@cdnsteve
Created January 29, 2014 03:27
Show Gist options
  • Save cdnsteve/8681316 to your computer and use it in GitHub Desktop.
Save cdnsteve/8681316 to your computer and use it in GitHub Desktop.
jQuery Rollovers
/**
* Image RollOver Effect
* ========================================================================
*/
jQuery(".rollover").hover(
function () {
var iconName = jQuery(this).attr("src");
var rollover = iconName.replace( /active/, 'rollover' );
jQuery(this).attr({ src: rollover });
},
function () {
var iconName = jQuery(this).attr("src");
var static = iconName.replace( /rollover/, 'active' );
jQuery(this).attr({ src: static });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment