I am working on website which uses Jquery and CSS3. I have image and on hover i want to scale image. Hover works with CSS but i want it to via JQuery following code i have tried till now. Please help.
HTML
<!DOCTYPE html>
<html >
<head>
<link rel="stylesheet" type="text/css" href="css/app.css" />
</head>
<body >
<img class="img-responsive" id ="thumbnail" src="my-image-src">
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<script>
$(document).ready(function(){
$("#thumbnail").on({
mouseenter: function () {
$(this).addClass("scaleout");
},
mouseleave:function () {
$(this).removeClass("scaleout");
}
},'img');
});
</script>
</body>
</html>
CSS
.scaleout {
transform: scale(1, 0.80);
-ms-transform: scale(1, 0.80);
-webkit-transform: scale(1, 0.80);
}
I also tried hover()
method instead of mouseenter
and mouseleave
in above script code
$(document).load(function(){
$('#thumbnail').hover(function(){
$(this).toggleClass('scaleout');
},
function(){
$(this).removeClass('scaleout');
});
});
Please help why hover not working.