【发布时间】:2010-08-11 11:06:08
【问题描述】:
我有以下代码示例(见下文)。我的问题是,在我离开光标后,工具提示没有显示“旧”文本 - 有什么想法吗?
<style type="text/css">
#tooltip {
position: absolute;
background: #FFF;
display: none;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('body').append('<div id="tooltip"></div>');
var tt = $('#tooltip');
$('a.tooltip').each(function(){
$(this).data('title', this.title).attr('title', '');
}).hover(function(){
var t = $(this), o = t.offset();
tt.html(t.data('title')).css({top: o.top, left: o.left}).fadeIn('fast');
},
function(){
tt.css({display: 'none'});
});
});
</script>
</head>
<body>
<a href="#" class="tooltip" title="VeryLongTextMoreTextVeryLongText">VeryLongText...VeryLongText</a>
【问题讨论】: