[英]How to identify multiple tooltip by css class
I've used this tooltip at my webpage. 我在网页上使用了此工具提示 。 My problem is, I'm using multiple styled and functional tooltip.
我的问题是,我正在使用多种样式和功能提示。 So, I've to identify them by unique class name.
因此,我必须通过唯一的类名来识别它们。 For example, I've two tooltips:
例如,我有两个工具提示:
<div class="tooltip" title="First Tooltip<span class='close'></span>">
This div has a tooltip when you hover over it!
</div>
<div class="tooltip-1" title="<a href='#'>Second Tooltip</a>">
This div has a tooltip too when you hover over!
</div>
I can make their function different by calling them with their class name: 我可以通过使用其类名调用它们来使它们的功能有所不同:
$('.tooltip').tooltipster({
interactive: true,
contentAsHTML: true,
});
$('.tooltip-1').tooltipster({
interactive: true,
contentAsHTML: true,
position: 'bottom'
});
But, I can't make their style different by their class name . 但是,我不能通过类名使它们的样式有所不同 。 For example, I'm trying apply different style at my second tooltip by css.
例如,我正在css的第二个工具提示中尝试应用不同的样式。 But, it's not working!
但是,它不起作用!
.tooltip-1 .tooltipster-default {
background-color: #fff;
color: #333;
}
.tooltip-1 .tooltipster-default .tooltipster-content {
padding: 0;
}
.tooltip-1 .tooltipster-content a {
padding: 8px 10px;
display: block;
color: #333;
}
So, how can I apply different style in my second tooltip ? 因此, 如何在第二个工具提示中应用不同的样式 ?
Just use 2 classes,.. 只需使用2个类,..
<div class="tooltip tooltipStyle_1"></div>
<div class="tooltip tooltipStyle_2"></div>
Then style both secondary classes the way you want. 然后按照您想要的方式设置两个辅助类的样式。
Also,... it might be working,.. but 另外,...可能正在工作,..但是
<div title="bla <someTag>bla</someTag>">
Can't you do that differently? 你不能那样做吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.