2011-03-13 65 views
0

爲什麼即使沒有爲工具提示設置qTip也會添加邊距?qTip即使沒有設置也顯示保證金?

下面是我使用的qTip配置:

$.fn.qtip.styles.mystyle = { 
       width: 200, 
       background: '#b7d5f4', 
       color: '#212121', 
       textAlign: 'left', 
       border: { 
        width: 1, 
        radius: 5, 
        color: '#b7d5f4' 
       }, 
       tip: 'bottomLeft', 
       name: 'dark' 
      } 

      $.each($(".tooltip"), function(i,val){ 
       var theContent = $(val).html(); 
       $(val).qtip({ 
        content: theContent, 
        position: { 
           corner: { 
           target: 'topRight', 
           tooltip: 'bottomLeft' 
           } 
          }, 
        style: 'mystyle' 
      }); 
}); 

內容div的類樣式看起來是這樣的:

.ttContent 
{ 
    width:     200px; 
    margin-left:   -8px; 
    margin-top:   -15px; 
} 

爲什麼我必須使用負利潤率在這裏獲得適當的利潤?

+0

你想要做什麼?以及爲什麼你要起訴不間斷的空間?它是[這](http://jsfiddle.net/ifaour/Hne3h/4/)你想要什麼? – ifaour 2011-03-13 15:11:53

+0

@ifaur>謝謝!這看起來很不錯,但工具提示中的圖標仍然有點偏離右側。但是,使用負邊界來處理這個問題可以嗎?如果你對這個問題作出回答,我會給予答覆。 – Banshee 2011-03-13 16:26:55

回答

2

在這裏你去:

$.fn.qtip.styles.mystyle = { 
    /*width: 200,*/ 
    background: '#b7d5f4', 
    color: '#212121', 
    textAlign: 'left', 
    padding: 2, 
    border: { 
     width: 1, 
     radius: 5, 
     color: '#b7d5f4' 
    }, 
    tip: 'bottomLeft', 
    name: 'dark' 
} 

$.each($(".tooltip"), function(i, val) { 

    var theContent = $(val).html(); 
    $(val).qtip({ 
     content: theContent, 
     position: { 
      corner: { 
       target: 'topRight', 
       tooltip: 'bottomLeft' 
      } 
     }, 
     style: 'mystyle' 
    }); 
}); 

我已經刪除了非中斷空格,該qtip寬度(擴展到內容的寬度),並應用了更小的填充。

工作example