Created
November 12, 2015 03:06
-
-
Save kohki-shikata/c53176a04ef37bab4c69 to your computer and use it in GitHub Desktop.
jQuery Roll Over
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// img roll over | |
$(function(){ | |
$("img[src*='_on']").addClass("current"); | |
$("img,input[type='image']").hover(function(){ | |
if ($(this).attr("src")){ | |
$(this).attr("src",$(this).attr("src").replace("_off.", "_on.")); | |
} | |
},function(){ | |
if ($(this).attr("src") && !$(this).hasClass("current") ){ | |
$(this).attr("src",$(this).attr("src").replace("_on.", "_off.")); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment