将鼠标悬停在绝对定位元素上会注册鼠标

时间:2017-04-21 18:18:16

标签: jquery css

See issue here

当我将鼠标悬停在图像上时会缩放,但当我将鼠标悬停在标题上时,变焦会重置。它就像绝对定位元素注册了一个mouseout。

.tint {
    overflow: hidden;
    float: left;
    background-color:#111;
    margin: 0 20px 20px 0;
  }


figure {
    display: block;
    position: relative;
    float: left;
    overflow: hidden;
    margin: 0 20px 20px 0;
}

figcaption {
    position: absolute;
    width:75%;
    color: white;
    padding: 5px;
    opacity: 0;
    -webkit-transition: all 0.6s ease;
    -moz-transition:    all 0.6s ease;
    -o-transition:      all 0.6s ease;
    font-family:Cachet;
    text-align:center;
    z-index:1000;
}

figure:hover figcaption {
    opacity: 1;
}

figcaption:hover
{

}

figure:before {
    position: relative;
    font-weight: 800;
    background: black;
    background: rgba(255,255,255,0.75);
    text-shadow: 0 0 5px white;
    color: black;
    width: 24px;
    height: 24px;
    -webkit-border-radius: 12px;
    -moz-border-radius:    12px;
    border-radius:         12px;
    text-align: center;
    font-size: 14px;
    line-height: 24px;
    -moz-transition: all 0.6s ease;
    opacity: 0.75;
}

figure:hover:before {
    opacity: 0;
}

.cap-bot:before { bottom: 0%; left: 0%; }
.cap-bot figcaption { left: 15%; bottom: 0%;}
.cap-bot:hover figcaption { bottom: 30%;left:15%;}

.zoom
{
    -moz-transform: scale(1.5);
    -webkit-transform: scale(1.5);
    transition: transform 1s;
    opacity: .5;
    cursor: pointer;    
]


.gallery_grid_image {
    display: block;
    -moz-transition: opacity .3s linear;
    -webkit-transition: opacity .3s linear;
    -ms-transition: opacity .3s linear;
    -o-transition: opacity .3s linear;
    transition: opacity .3s linear;
}

有什么想法吗?我正在使用Jquery添加缩放类。

            $(".comment_preview").on({
                "mouseover" : function() {
                    $(this).find('.gallery_grid_image').addClass('zoom');
                },
                "mouseout" : function() {
                    $(this).find('.gallery_grid_image').removeClass('zoom');
                }
            });         

1 个答案:

答案 0 :(得分:0)

使用pointer-event: none;告诉所有内容忽略该元素。

MDN: pointer-events