Sunday, January 11, 2015

jQuery Image effect on Mouseover with Opacity light and dark

Introduction:

Here I will explain how to use jQuery to change image opacity on mouseover using jQuery or change opacity of image on hover using jQuery.

Here is the aspx code with the jQuery function.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Change Image Opacity on Mouse Over</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function() {
$("#logoimage").css("opacity", 0.5);
$("#logoimage").hover(function() {
$(this).animate({ opacity: 1.0 }, 500);
}, function() {
$(this).animate({ opacity: 0.5 }, 500);
});
})
</script>
</head>
<body>
<form id="form1">
<div>
<img id="logoimage"  src="http://3.bp.blogspot.com/-Ss_jAFd_tAw/VI7UW0_x1lI/AAAAAAAAQDw/5Uko0Ic_P0w/s1600/aavv.JPG" />
</div>
</form>
</body>
</html>




No comments:

Post a Comment