【发布时间】:2013-03-24 06:11:34
【问题描述】:
我有这个 jquery:
this.tooltip = function(){
/* CONFIG */
xOffset = 10;
yOffset = 20;
// these 2 variable determine popup's distance from the cursor
// you might want to adjust to get the right result
/* END CONFIG */
$("a.tooltip").hover(function(e){
this.t = this.title;
this.title = "";
$("body").append("<p id='tooltip'>"+ this.t +"</p>");
$("#tooltip")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px")
.fadeIn("fast");
},
function(){
this.title = this.t;
$("#tooltip").remove();
});
$("a.tooltip").mousemove(function(e){
$("#tooltip")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
});
};
// starting the script on page load
$(document).ready(function(){
tooltip();
});
与名为“tooltip”的 CSS 类一起使用,其中包含 font-variant:small-caps;。
所有工具提示都采用小型大写字母,看起来很棒:)
工具提示是这样调用的:
<a href="#" class="tooltip" title="this is the tooltip">hover to see tooltip</a>
我想在工具提示中包含一两个单词 BOLD 并且全部小写.. 如何在不破坏工具提示的重置的情况下做到这一点?
所以不要显示为:
这是工具提示
我想要:
这是工具提示
有什么想法吗??
【问题讨论】: