2012-11-26 73 views

回答

5

通過@Adrian解決方案不會對引導工作3.使用下列內容:

$('[rel=tooltip]').tooltip(); 
$(document).on('hover', '[rel=tooltip]', function() { $(this).tooltip('show'); }); 
$(document).on('focus', '[rel=tooltip]', function() { $(this).tooltip('show'); }); 
4

你試過data-trigger="focus hover"

+0

我試過數據 - trigger =「focus hover」,data-trigger =「hover focus」。兩者都只在焦點上觸發,而不是懸停。 – RLeisinger

+0

快速查看源代碼或文檔可以驗證這是迄今爲止不可能的。 –

+1

我的是不同的,懸停的作品,但重點不... woah ..... – kebyang

3

trigger是一個單值屬性,所以你要假的或者這兩種方法:

$('.tooltip').tooltip({trigger: 'hover'}).each(function() { 
    var $this = $(this), data = $this.data('tooltip'); 
    $this.on('focus.tooltip', $.proxy(data.enter, data)) 
    .on('blur.tooltip', $.proxy(data.leave, data)); 
}); 

更新:另外,你可以用我的patch到Twitter的引導來使trigger具有多值屬性,並將其設置爲hover focus

+0

我試圖使用該補丁,仍然得到/或但不是多個觸發器。我在上面使用了'假',它在我沒有指定數據觸發器時起作用。我會繼續嘗試這個補丁。感謝您的幫助。 – RLeisinger

+0

你可以發佈你嘗試jsfiddle的代碼嗎?無論如何,我們應該把這個討論轉到[pull request](https://github.com/twitter/bootstrap/pull/6102)。 –