JQuery mouseover image overlay

前端 未结 3 1464
时光说笑
时光说笑 2021-01-13 13:23

Just wondering how I can get this working 100% correctly. I think I\'m nearly there.

Basically, I have an image & when I mouseover, I want an overlay (which is a

3条回答
  •  执念已碎
    2021-01-13 14:14

    The simplest solution is to add a wrapping element for both elements:

    And place the mouseover/mouseout methods to that element instead:

    $('.wrap').mouseover(function () {
        $('.company-image-overlay').show();
    }).mouseout(function () {
        $('.company-image-overlay').hide();
    });
    

    JS Fiddle demo.

提交回复
热议问题