在這裏的一些偉大的人的幫助下,我想要得到一個jQuery懸停工具提示工作:) ..下一步實際上將懸停應用到跨班級而不是鏈接...(因爲我沒有需要他們聯繫......但在未來我可能需要添加一個可點擊的鏈接),所以目前...將動作應用於跨度而不是鏈接?
$(document).ready(function(){
$('.tippytrip').hover(function(){
var offset = $(this).offset();
console.log(offset)
var width = $(this).outerWidth();
var tooltipId = this.hash;
$('#tooltip-container').empty().load
('tooltips.html ' + tooltipId).show();
$('#tooltip-container').css({top:offset.top,
left:offset.left + width + 10}).show();
}, function(){
$('#tooltip-container').hide();
});
});
我認爲部分是罪魁禍首就是:
var tooltipId = this.hash;
我已經嘗試了各種各樣的東西,基本上我需要改變它:
<a href="#tip1" class="tippytrip">Show Tip 1 - again</a>
到:
<span class="tippytrip" rel="tip1">Show Tip 1</span>
非常感謝
我認爲一個鏈接將實際上被罰款,但你只需將其更改爲'無功tooltipId =「# '+ $(this).attr('rel');',儘管'rel'不是'span'標籤的有效屬性。 – 2012-02-02 12:37:03