【问题标题】:qTip2. I'm not able to add the "position" codeqTip2。我无法添加“位置”代码
【发布时间】:2014-01-26 12:00:09
【问题描述】:

我对javascript一无所知。有人可以解释一下这段代码有什么问题(这是语法错误)吗?

$(document).ready(function () {
$('.picture').qtip(
{
    content: {
             text: $(this).next('.tooltiptext')
             }
    position: {
            my: 'bottom center',  // tooltips tip at bottom center...
            at: 'top center', // in relation to the button's top center...
            target: $('.picture') // my target
              }
 });
}); 

非常感谢。

【问题讨论】:

  • 如果是语法错误,就会出现控制台错误 - 按F12查看

标签: javascript syntax qtip2


【解决方案1】:

我认为您在 qtip 的属性值之间缺少,

试试:

$(document).ready(function () {
    $('.picture').qtip({
        content: {
            text: $(this).next('.tooltiptext')
        }, // <-- here
        position: {
            my: 'bottom center', // tooltips tip at bottom center...
            at: 'top center', // in relation to the button's top center...
            target: $('.picture') // my target
        }
    });
});

【讨论】:

  • 非常感谢欧文! qTip 现在位于正确的位置,但他没有显示 .tooltiptext div 的内容。有什么线索吗?
  • (对不起,作为新用户,我没有权限在明天之前发布新答案)。我的 HTML 没问题。这意味着如果我删除“位置”,qTip 可以完美运行。 .tooltiptex div 是一个常规的 HTML div。我认为 javascript 中的某些内容仍然丢失...非常感谢您的帮助!
  • 您是否有多个具有类 picture 的元素,请编辑问题并提供您的 HTML 标记
猜你喜欢
  • 1970-01-01
  • 2018-03-11
  • 1970-01-01
  • 2017-06-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-08
相关资源
最近更新 更多