您可以添加
#PictureHoverPanel
以及事件听众。
这样地:
$(document).on("mouseover", "#imagebox, #PictureHoverPanel", function() {
$("#PictureHoverPanel").removeClass("invisible");
})
$(document).on("mouseover", "#imagebox, #PictureHoverPanel", function() {
$("#PictureHoverPanel").removeClass("invisible");
})
$(document).on("mouseout", "#imagebox, #PictureHoverPanel", 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">