我使用的是jQuery UI 工具提示小部件
<li>
<div class="i1">
<a href="#inf-1"title="ΕΝΤΟΠΙΣΜΟΣ">
<span class="ui-icon ui-icon-search"></span>
</a>
</div>
</li>
<li><a href="#inf-2"title="ΠΛΗΡΟΦΟΡΙΕΣ"><span class="ui-icon ui-icon-info"></span></a></li>
<li><a href="#inf-3"title="ΕΠΙΠΕΔΑ"><span class="ui-icon ui-icon-copy"></span></a></li>我根据他们的例子写了下面的CSS,它很有魅力:
.tooltip {
display:none;
background: black;
font-size:12px;
height:10px;
width:80px;
padding:10px;
color:#fff;
z-index: 99;
bottom: 10px;
border: 2px solid white;
/* for IE */
filter:alpha(opacity=80);
/* CSS3 standard */
opacity:0.8;
}但是我得到了3-4个工具提示,我想看起来不一样(比如上面的示例html ),所以我将它们封装在一个类中,然后执行如下操作:
.i1 .tooltip {
display:none;
background: red;
font-size:12px;
height:40px;
width:80px;
padding:20px;
color:#fff;
z-index: 99;
bottom: 10px;
left: 50px important!;
border: 2px solid white;
/* for IE */
filter:alpha(opacity=80);
/* CSS3 standard */
opacity:0.8;
}这绝对没什么用。如何重写泛型.tooltip以不同方式自定义某些工具提示?
提前感谢
发布于 2012-10-27 21:00:37
对于那些希望将自定义类应用到新的工具提示小部件(jQuery UI 1.9.1)的人,extraClass似乎不再工作了,但是有一个新的选项叫做tooltipClass。
$('.selector').tooltip({
tooltipClass: "your_class-Name",
});为了解决与jQuery的css的潜在冲突,您可能需要将!important添加到css中行的末尾。感谢@sisharp指出这一点:)
发布于 2016-09-28 21:43:50
我试着在上面这个很好的答案的基础上,设计泡泡,去掉旧的.
如果你和我一样是新手(在其他情况下,简单的任务需要几个小时),那么在同一个地方同时得到答案是很好的:)以下是几个来源的解决方案,包括这个问题:
<a href="#" title="We are trying hard" class="mytooltip"><span title="">BETA</scan></a>跨距移除浏览器气泡。
以新气泡的CSS为例:
.mytooltip:hover:after{
background: #333;
background: rgba(0,0,0,.9);
border-radius: 5px;
bottom: 26px;
color: rgb(255, 77, 85);
content: attr(title);
right: 20%;
padding: 5px 15px;
position: absolute;
z-index: 98;
width: 220px;}
.mytooltip:hover:before{
border: solid;
border-color: #333 transparent;
border-width: 6px 6px 0 6px;
bottom: 20px;
content: "";
right: 50%;
position: absolute;
z-index: 99;
}
.mytooltip {
radius: 4px !important;
background-color: black;
color: rgb(255, 77, 85) !important;
padding: 5px 20px;
border-radius: 20px;
margin: 50px;
text-align: center;
font: bold 14px ;
font-stretch: condensed;
text-decoration: none;
box-shadow: 0 0 10px black;
}以及上面提到的脚本,插入于页脚:
<script>
$('.selector').tooltip({
tooltipClass: "mytooltip",
});
</script>谢谢你对这个问题,这和我忘记了另一个来源。
发布于 2013-06-21 19:14:08
实际上它
$( ".selector" ).tooltip( "option", "tooltipClass", "custom-tooltip-styling" );请参阅这里
https://stackoverflow.com/questions/4780759
复制相似问题