0

I have this issue that I've ran into in which I have two images that animates on mousein but once the img animates it moves the other img that is next to it. I want the img is increase height and width while having no effect on the other imgs, like something that we would see in a online gallery. My current progress is below html

    <!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <title>Document</title>
  <style>

  ul li {
 list-style-type: none;
 background-color: "red";
 display: inline;
}

li img {
 cursor: pointer;
 display: inline-block;
}


  </style>
</head>
<body>
  <ul>
  <li>
    <img src="https://secure.gravatar.com/avatar/c370cf7247c52385734adad9f4fc755c?s=160&d=retro&r=pg" alt="">
  </li>
<li>
    <img src="https://www.klickypedia.com/wp-content/images/facebook.png" alt="">
  </li>

</ul>
<script>
var $li = $('ul li img');

$li.mouseover(function(){
var currentHeight = $(this).height();
$(this).animate({
  height: currentHeight*1.3
},50,function(){
  $(this).mouseout(function(){
    $(this).animate({
      height: currentHeight
    },50)
  }).stop();
})
})

</script>
</body>
</html>

Here's a fiddle demonstrating what I've done so far.

James Hill
  • 60,353
  • 20
  • 145
  • 161
Alase Ruth
  • 11
  • 2

0 Answers0