jquery - 即使未设置,qTip 也会显示边距?

标签 jquery css 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;
}

为什么我必须在这里使用负边距来获得适当的边距?

最佳答案

给你:

$.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 .

关于jquery - 即使未设置,qTip 也会显示边距?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5290069/

相关文章:

javascript - Stripe.js 保留多个支付 token

ipad - iPad 上的 jQuery Mobile 过渡缓和

CSS 标签边框问题

jquery - qTip2显示和隐藏缓慢

javascript - 如何从 setInterval() 调用 js 函数

javascript - jquery递归函数中奇怪的无限循环错误

javascript - 如何动态创建html元素?

css - 更改 native 文本项的字体​​?

jQuery qTip 回调不起作用

javascript - 如何增强不应修改其源代码的页面的功能?