I am building an application that initially displays a collection of pictures giving the user the possibility to select some of them and add them to another div.
For these dynamically added images I need to enable hovering functionality to enlarge images on hover.
This my Jquery approach:
$(document).on('hover','#zooming',function(){
$("#zooming").addClass('hover');
}
, function() {
$("#zooming").removeClass('hover');
}
);
css code:
#zooming{
&.hover{
cursor: pointer;
color:white;
background: #dbdbe0;
z-index: 1000;
padding:20px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
width:auto;
height:auto;
}
}
when I use this approach the enlargement of image never happens after hovering.
When I use
$(document).on('hover','#zooming',function(){
$("#zooming").addClass('hover');
}
);
The image is enlarged but never goes back to its original size which is normal. Could you spot what am I doing wrong here?
Thank you very much.