jquery plugin for “image swap on hover”

<!DOCTYPE html>
<html>
<head>
<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js“></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>

<img src=”http://www.w3.org/html/logo/downloads/HTML5_Logo_512.png” />

</body>
</html>

$(‘document’).ready(function() {

$(‘img’).on({
‘mouseover’ : function() {
$(this).attr(‘src’,’http://media02.hongkiat.com/css3-code-slim/css3-markup.jpg‘);
},
mouseout : function() {
$(this).attr(‘src’,’http://www.w3.org/html/logo/downloads/HTML5_Logo_512.png‘);
}
});
});

jquery Image Swap On Hover

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s