Created
July 3, 2015 18:08
-
-
Save naoyeye/d6c445e7ba7a86a1fdbd to your computer and use it in GitHub Desktop.
png - gif
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>test</title> | |
<style type="text/css"> | |
.image { | |
display: inline-block; | |
width: 150px; | |
} | |
img { | |
max-width: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<a href="###" class="image fit thumb"> | |
<img class="giff" src="http://t.wdjcdn.com/upload/mkt-campaign/test/demo1.png" alt="" /> | |
</a> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(function () { | |
$(".giff").hover( | |
function () { | |
var src = $(this).attr("src"); | |
$(this).attr("src", src.replace(/\.png$/i, ".gif")); | |
}, | |
function () { | |
var src = $(this).attr("src"); | |
$(this).attr("src", src.replace(/\.gif$/i, ".png")); | |
} | |
); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment