我指的是 answers of this question自定义工具提示 div 样式但没有完成。这是我的 CSS:
<style type="text/css">
.ttExtra
{
background-color: Black !important;
color:Red !important;
}
</style>
和 jQuery:
<script type="text/javascript">
$('.userdetails').tooltip({
tooltipSourceID: '#userprofile',
loader: 1,
//loaderImagePath: 'animationProcessing.gif',
//loaderHeight: 16,
//loaderWidth: 17,
width: '400px',
height: '200px',
tooltipSource: 'inline',
borderSize: '2',
borderColor :'#000000',
tooltipBGColor: '#efefef',
tooltipClass: 'ttExtra'
});
</script>
我看不到我在 css 类中提到的工具提示样式。这里一定有什么问题?
谢谢。
最佳答案
在 jQuery UI 中自定义工具提示(自定义样式):
<a href="#" title="This is a tooltip">Tooltips</a>
<script>
$(function() {
$( document ).tooltip({
position: {
my: "center bottom-20",
at: "center top",
using: function( position, feedback ) {
$( this ).css( position );
$( "<div>" )
.addClass( "arrow" )
.addClass( feedback.vertical )
.addClass( feedback.horizontal )
.appendTo( this );
}
}
});
});
</script>
<style>
.ui-tooltip, .arrow:after {
background: #efefef;
color:red;
border:2px solid #000;
width: 400px;
}
.ui-tooltip {
padding: 10px 20px;
color: white;
border-radius: 20px;
font: bold 14px "Helvetica Neue", Sans-Serif;
text-transform: uppercase;
box-shadow: 0 0 7px black;
}
.arrow {
width: 70px;
height: 16px;
overflow: hidden;
position: absolute;
left: 50%;
margin-left: -35px;
bottom: -16px;
}
.arrow.top {
top: -16px;
bottom: auto;
}
.arrow.left {
left: 20%;
}
.arrow:after {
content: "";
position: absolute;
left: 20px;
top: -20px;
width: 25px;
height: 25px;
box-shadow: 6px 5px 9px -9px black;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.arrow.top:after {
bottom: -20px;
top: auto;
}
</style>
关于jquery - TooltipClass 不适用于 jQuery UI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31283924/