2011-03-13 69 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