回答

2

我通過以下操作獲得了小版本button的版本。

首先,應用類到你的filestyle輸入:

<input type="file" class="filestyle apply-tooltip" data-input="false" data-buttontext="" data-iconname="glyphicon-paperclip"/> 

通知的.apply_tooltip類?接下來,遍歷這個類的元素,並指定幾個屬性,他們的兄弟姐妹<div>元素(由filestyle生成):

$('.apply-tooltip').each(function(){ 
    $(this).siblings("div").attr("data-toggle", "tooltip"); 
    $(this).siblings("div").attr("title", "Attach File"); 
}); 

最後,請致電$([data-toggle="tooltip"]).tooltip()功能,你通常會。這將激活生成的<div class="bootstrap-filestyle input-group">上的tooltip

您需要這樣做的原因是filestyle隱藏了用於生成自定義輸入字段的任何元素。正因爲如此,tooltip被正確激活,但在一個隱藏的元素。

這是你的jsfiddle的修改版本顯示在實踐中:

http://jsfiddle.net/admvx689/1/

我去看看,如果我能得到其他兩個工作爲好。儘管希望現在有幫助!

編輯

它實際上適用於較大的輸入也一樣,你只需要在正確的部分(右邊的按鈕)懸停

http://jsfiddle.net/admvx689/3/

+0

你是個天才!非常感謝。我還從輸入元素中刪除了'data-toggle =「tooltip」title =「附件文件」,以刪除彈出到右側的附加工具提示。再次感謝! – JDawg

+0

沒問題!很高興你能爲你工作。乾杯! –

相關問題