jQuery qTip 不改变类?

发布于 2024-11-27 06:23:06 字数 1284 浏览 0 评论 0原文

你好,我正在使用 qTip 2,我想要 ui-tooltip-dark ui-tooltip-shadow 类,但它没有显示该类。我有这个代码:

    $('.selector').qtip({
   content: {
      text: function(api) {
         // Retrieve content from custom attribute of the $('.selector') elements.
         return $(this).attr('qtip-content');
        }
      },
      title: {
         text: function(api) {
            // Retrieve content from ALT attribute of the $('.selector') element
            return $(this).attr('alt');
         }
      },
     style: {
      classes: 'ui-tooltip-dark ui-tooltip-shadow';
      }
});

但是当我把代码放在他们的网站上时,它就

可以工作了,你能告诉我哪里出了问题吗?

编辑

    <script type="text/javascript" class="example">
$(document).ready(function()
{
    $('.selector').qtip({
   content: {
      text: function(api) {
         // Retrieve content from custom attribute of the $('.selector') elements.
         return $(this).attr('qtip-content');
      }
     },
      title: {
         text: function(api) {
            // Retrieve content from ALT attribute of the $('.selector') element
            return $(this).attr('alt');
         }
      },
     style: {
      classes: 'ui-tooltip-dark ui-tooltip-shadow';
      }
});
});
</script>

Hii i am using qTip 2 i want the class ui-tooltip-dark ui-tooltip-shadow but it doesnt shows that class. I have this code:

    $('.selector').qtip({
   content: {
      text: function(api) {
         // Retrieve content from custom attribute of the $('.selector') elements.
         return $(this).attr('qtip-content');
        }
      },
      title: {
         text: function(api) {
            // Retrieve content from ALT attribute of the $('.selector') element
            return $(this).attr('alt');
         }
      },
     style: {
      classes: 'ui-tooltip-dark ui-tooltip-shadow';
      }
});

But when i put the code that is on their site it works

Can u please tell me where am i going wrong ?

EDIT

    <script type="text/javascript" class="example">
$(document).ready(function()
{
    $('.selector').qtip({
   content: {
      text: function(api) {
         // Retrieve content from custom attribute of the $('.selector') elements.
         return $(this).attr('qtip-content');
      }
     },
      title: {
         text: function(api) {
            // Retrieve content from ALT attribute of the $('.selector') element
            return $(this).attr('alt');
         }
      },
     style: {
      classes: 'ui-tooltip-dark ui-tooltip-shadow';
      }
});
});
</script>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酷遇一生 2024-12-04 06:23:06

这可能只是您发布的内容中的一个拼写错误,但您在内容部分周围缺少一个大括号 -

$('.selector').qtip({
   content: {
      text: function(api) {
         // Retrieve content from custom attribute of the $('.selector') elements.
         return $(this).attr('qtip-content');
      }
     },
      title: {
         text: function(api) {
            // Retrieve content from ALT attribute of the $('.selector') element
            return $(this).attr('alt');
         }
      },
     style: {
      classes: 'ui-tooltip-dark ui-tooltip-shadow';
      }
});

编辑

试试这个 -

$(document).ready(function()
{
    $('.selector').qtip({
   content: {
      text: function(api) {
         // Retrieve content from custom attribute of the $('.selector') elements.
         return $(this).attr('qtip-content');
      },
      title: {
         text: function(api) {
            // Retrieve content from ALT attribute of the $('.selector') element
            return $(this).attr('alt');
         }
      }
   },
   style: {
      classes: 'ui-tooltip-dark ui-tooltip-shadow'
      }      
    });
});

您应该能够看到它在这里工作 - http://jsfiddle.net/KaJ9q/

It might just be a typo in what you've posted but you're missing a curly brace around the content section -

$('.selector').qtip({
   content: {
      text: function(api) {
         // Retrieve content from custom attribute of the $('.selector') elements.
         return $(this).attr('qtip-content');
      }
     },
      title: {
         text: function(api) {
            // Retrieve content from ALT attribute of the $('.selector') element
            return $(this).attr('alt');
         }
      },
     style: {
      classes: 'ui-tooltip-dark ui-tooltip-shadow';
      }
});

EDIT

Try this -

$(document).ready(function()
{
    $('.selector').qtip({
   content: {
      text: function(api) {
         // Retrieve content from custom attribute of the $('.selector') elements.
         return $(this).attr('qtip-content');
      },
      title: {
         text: function(api) {
            // Retrieve content from ALT attribute of the $('.selector') element
            return $(this).attr('alt');
         }
      }
   },
   style: {
      classes: 'ui-tooltip-dark ui-tooltip-shadow'
      }      
    });
});

You should be able to see it working here - http://jsfiddle.net/KaJ9q/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文