Div mouseenter and mouseleave

I have two Divs (CSS is TailwindCss)

$(document).on("mouseover", "#imagebox", function() {
  $("#PictureHoverPanel").removeClass("invisible");

})

$(document).on("mouseout", "#imagebox", function() {
  $("#PictureHoverPanel").addClass("invisible");

})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.0.3/tailwind.min.css" integrity="sha512-wl80ucxCRpLkfaCnbM88y4AxnutbGk327762eM9E/rRTvY/ZGAHWMZrYUq66VQBYMIYDFpDdJAOGSLyIPHZ2IQ==" crossorigin="anonymous" />


<div id="PictureHoverPanel" class="invisible absolute flex flex-col justify-center rounded-xl bg-gray-600 opacity-70">
  <div class="flex justify-center">
    <a class="bg-gray-800 px-2 py-1 text-white border border-red-800 font-semibold cursor-pointer">Remove</a>

  </div>

</div>
<img id="imagebox" class="w-48 h-48 rounded-xl md:w-64 md:h-64" src="https://picsum.photos/seed/1/100">

The problem is as I enter #imagebox every mouse move triggers the mouseout event resulting in a really quick blink. How can I make sure that the invisible class will not be added unless the cursor is fully out of imagebox

76 thoughts on “Div mouseenter and mouseleave”