I cannot seem to get this jQuery animation working for applying a border to an image on mouseenter
:
<div>
<img src="http://25.media.tumblr.com/acc96259d6b2678985052c33e05a3062/tumblr_mkv9fhDBDS1rmc58qo1_500.jpg" />
</div>
jQuery
$('div img').mousenter(function(){
$(this).css({"border": "0px solid #f37736"}).animate({
'borderWidth': '4px',
'borderColor: '#f37736'
},500);
}).mouseleave(function(){
$(this).animate({
'borderWidth':'0px',
'borderColor:'#f37736'
},500);
});
I also tried removing the CSS part for the jQuery, but does not work either
Change your jQUERY to this
$('div img').mouseenter(function(){
$(this).css("border", "0px solid #f37736").animate({
'borderWidth': '4px',
'borderColor': '#f37736'
},500);
}).mouseleave(function(){
$(this).animate({
'borderWidth':'0px',
'borderColor':'#f37736'
},500);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With