简体   繁体   English

禁用文字悬停效果

[英]Disable text hover effect

So I am trying to disable the "hover" state of a text tspan tag. 所以我试图禁用文本tspan标记的“悬停”状态。 I have an element below that already has an hover state and whenever I place the mouse over the text the hover effect "flashes". 我有一个已经有悬停状态的元素,每当我将鼠标放在文本上时,悬停效果“闪烁”。 I want the text to be ignored in the hover state. 我希望在悬停状态下忽略文本。

See in this example , the "Morbihan" area, when we place the mouse over the text "Morbihan", the hover effect of the area flashes. 在本例中 ,参见“Morbihan”区域,当我们将鼠标放在文本“Morbihan”上时,该区域的悬停效果会闪烁。 The same happens to the tooltip, I want to disable that effect, when hovering the text just continue with the tooltip and highlight color of the area. 工具提示也是如此,我想禁用该效果,当悬停文本时,只需继续使用工具提示并突出显示该区域的颜色。

http://jsfiddle.net/neveldo/jh4jzyhw/ http://jsfiddle.net/neveldo/jh4jzyhw/

So far I only disabled the text cursor: 到目前为止我只禁用了文本光标:

    tspan {
        cursor: default;
    }

Thank you. 谢谢。

I think you're looking for pointer-events:none; 我想你正在寻找pointer-events:none; on the text element. text元素上。

text {
    pointer-events:none;
}

Note that applying that styling to the tspan will not work. 请注意,将该样式应用于tspan将不起作用。 If you need to do that, you'll need to use jQuery to apply the style to the parent text element. 如果需要这样做,则需要使用jQuery将样式应用于父text元素。 Something like $('tspan').parent().css({ pointerEvents: 'none' }); $('tspan').parent().css({ pointerEvents: 'none' }); (pseudo-code, untested) (伪代码,未经测试)

http://jsfiddle.net/daveSalomon/jh4jzyhw/155/ http://jsfiddle.net/daveSalomon/jh4jzyhw/155/

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

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