2013-10-27 58 views
1

當我使用bootstrap 3.0 popover與放置:自動右表內部它不起作用,並且它流離開表大小。bootstrap彈出窗口3.0與表

位置:汽車右(指酥料餅應該流向的權利,如果它有一個地方,否則流到左)

檢查此鏈接:

http://jsfiddle.net/DTcHh/65

然而,當我把它在桌子外面,它的工作原理應該是這樣!

$('button.hey').popover({ 
placement: 'auto left', 
html: true, 
    //selector: '[rel="popover"]', 
    content: function() { 
     return "Hi man"; 
    } 
}) 

任何想法?

回答

3

在你的情況,我建議你編寫自己的回調,而不是使用'自動'。

如果你想'除了最後td以外的所有按鈕'正確'。以下是可以如何寫入位置

$('button.hey').popover({ 
    placement: function(context,source){ 
     //check if current td is last one 
     var td = $(source).closest('td'); 
     console.log(td); 
     if(td.next().length == 0) { 
      return 'left'; 
     } 
     return 'right'; 
    }, 
    html: true, 
    //selector: '[rel="popover"]', 
    content: function() { 
     return "Hi man"; 
    } 
}) 

如果您想基於位置進行處理,則可以在放置回調中處理該位置。

檢查這個小提琴http://jsfiddle.net/codejack/DTcHh/66/

+1

謝謝你!我想給你大拇指,但我沒有15分:P一旦我得到它,我會給你豎起大拇指:D – Abzoozy