Created
November 16, 2015 05:24
-
-
Save kohki-shikata/49341d1862fc2e89fe87 to your computer and use it in GitHub Desktop.
jQuery img rollover
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