hover - Create a border around an image when hovered over with JQuery -


i have code try , resize image add 10px solid red border around it. figured out how resize image, cannot figure out how animate when hover on mouse, red border shows up. appreciated. feel close not there quite yet. thank all!

<!doctype html> <html> <head> <title>image resize</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>  <script> $(function() {     var ht = $("img").height(),         wd = $("img").width(),         mult = 1.5;       $("img").on('mouseenter', function () {         $(this).animate({             height: ht * mult,             width: wd * mult,         }, 500);     });      $("img").on('mouseenter', function () {         $(this).animate({"border" : "10px solid red"} , "slow");     });      $("img").on('mouseleave', function () {         $(this).animate({             height: ht,             width: wd         }, 500);     })      $("img").on('mouseleave', function (){         $(this).animate({"border-radius" : "0px"}, "slow");     }); }); </script>   </head>   <body>  <img src="https://cdn1.iconfinder.com/data/icons/yooicons_set01_socialbookmarks/512/social_google_box.png" width="200" height="200"  alt="" />  </body>    </html> 

you cannot animate color can animate boderwidth:

$('img').mouseenter(function () {     $(this).css({border: '0 solid red'}).animate({         borderwidth: 10     }, 500);     }).mouseleave(function () {      $(this).animate({         borderwidth: 0     }, 500); }); 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -