简体   繁体   English

忽略以 div 内的图像为中心的文本的鼠标悬停

[英]Ignore mouseover of text centered over image inside div

I have text centered over an image inside of a div.我的文本以 div 内的图像为中心。

<div class="row">
   <div class="col-md-4"><img src="dog.jpg" class="panel"><div class="panel-text">ONE ONE ONE</div></div>
   <div class="col-md-4"><img src="dog.jpg" class="panel"><div class="panel-text">TWO TWO TWO</div></div>
   <div class="col-md-4"><img src="dog.jpg" class="panel"><div class="panel-text">THREE THREE</div></div>
</div>
           

When the image is mouseover'd, the image is enlarged with CSS transform: scale(1.2)当图像被鼠标悬停时,图像被 CSS 变换放大:scale(1.2)

.panel:hover {
    transform: scale(1.2);
}

My problem is, if the text inside the div (centered over image) is mouseover'd, the .panel:hover is ignored and goes back to normal state.我的问题是,如果 div 内的文本(以图像为中心)被鼠标悬停,则 .panel:hover 将被忽略并恢复正常状态。 How can I ignore/disable the text in case the text is mouseover'd and keep transform: scale(1.2);如果文本被鼠标悬停,我如何忽略/禁用文本并保持转换:比例(1.2); active?积极的?

Live demo here https://vendbits.com/wp_gpl/现场演示https://vendbits.com/wp_gpl/

Thanks in advance.提前致谢。

you can add pointer-events: none;您可以添加pointer-events: none; to the text到文本

.panel-text{
   pointer-events: none;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM