【问题标题】:manual positioning adjust on qtip tooltip (not working)qtip 工具提示上的手动定位调整(不工作)
【发布时间】:2011-05-15 00:40:49
【问题描述】:
 $('#nav a[href][title]').qtip({
      content: {
         text: false // Use each elements title attribute
      },
      position: {
     corner: {
        target: 'topLeft',
        tooltip: 'middleRight'
                }
                },
     style: {
       name: 'dark',
       width: 230,
       padding: 3,
       bottom: 10,
       textAlign: 'center'
      }
 // Give it some style
   });

我想模拟:css: position:relative;bottom:10px 所以工具提示与目标垂直对齐(见图),但我无法完成

这样尝试

$('#nav a[href][title]').qtip({
      content: {
         text: false // Use each elements title attribute
      },
      position: {
     corner: {
        target: 'topLeft',
        tooltip: 'middleRight'
                }
                },
     style: {
       name: 'dark',
       width: 230,
       padding: 3,
       position: 'relative',
       bottom: 10,
       textAlign: 'center'
      }
 // Give it some style
   });

但是工具提示的文本被移动了,而不是工具提示本身,

我该怎么做?

编辑

尝试“调整”属性,但我找不到语法错误

$('#nav a[href][title]').qtip({
      content: {
         text: false // Use each elements title attribute
      },
      position: {

      adjust: {
              x: 10px,
              y: 10px
       },

     corner: {
               target: 'topLeft',
               tooltip: 'middleRight'
                }
     },
     style: {
       name: 'dark',
       width: 230,
       padding: 3,
       textAlign: 'center'
      },
 // Give it some style
   });

【问题讨论】:

    标签: jquery css position qtip


    【解决方案1】:

    您可以使用“位置”属性组的“调整”属性,如下所示:

    position: {
        corner: {
            target: 'topLeft',
            tooltip: 'middleRight'
            },
        adjust: {
            x: 10,
            y: 10
            }
        }
    

    我提供的数字是任意的。你可以和他们一起玩到你想要的位置。

    【讨论】:

    • 感谢您的回复,即将编辑我的问题,因为 Netbeans 跳转语法错误(并且没有启用 corse qtip),我应该如何放置它?再次感谢您!
    • using->adjust: { x: '10px', y: '10px' } 消除了错误,但似乎没有任何效果
    • 你使用的是qtip还是qtip2?他们已经发布了 qtip2,旧的很快就会过时。不需要重写,只需下载 qtip2 js 文件并用它替换旧文件。至于调整,我的错,你不需要 px,只需使用不带引号的普通数字。
    • 好的,就是这样。我的解决方案:调整:{ y: -10 }
    • 如果您仍在使用 jquery.qtip-1.0.0-rc3.js 以及 jQuery 1.8.2 或更低版本,您可能需要更新 q​​tip 库以调用 .outerHeight 和 .outerWidth调用包括布尔参数以获得正确的位置和尺寸。确切地说,只需将以下方法调用替换: .outerHeight() 和 .outerWideth() 用 .outerHeight(true) 和 .outerWidth(true) 布尔值指示包含/排除边距,在版本 1.8.2 或与仅调用返回 jQuery 对象的 the.outerHeight 和 outerWidth 相比,less 似乎返回了实际值。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多