Hover over image to show buttons and don't trigger when hovering over actual buttons

后端 未结 2 1978
有刺的猬
有刺的猬 2021-02-08 22:38

I\'m trying to get buttons to appear when hovering over an image. The following works:


    jQuery(\'.show-image\').mouseenter(function() {
 jQuery(\'.the-button         


        
2条回答
  •  走了就别回头了
    2021-02-08 23:22

    Put the image and the button in the same div, then put the mouseover/mouseout events on the div. Than whether your mouse is over either the button or the image, it will still be over the div.

    Also I am not sure if mouseenter(...).mouseout(...) will work. I always use hover(..., ...)

提交回复
热议问题