qTip工具提示不起作用

qTip tooltip wont work

本文关键字:不起作用 工具提示 qTip      更新时间:2023-09-26

我正在尝试让qTip工作,但它没有显示任何工具提示。这是我的代码:

<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript">
</script>
<script src="@Url.Content("~/Scripts/jquery.qtip-1.0.0-rc3.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    // Create the tooltips only on document load
    $(document).ready(function () {
        $("#question").each(function() { 
        qtip({
        content: 'Dark themes are all the rage!',
        show: 'mouseover',
        hide: 'mouseout'
        style: { 
        name: 'dark', // Inherit from preset style
   }
});
</script>

我有一个div容器,看起来像这样:

<div id="question">@Html.LabelFor(y => item.question_wording, item.question_wording)</div>

我做错了什么?

您的代码应该如下所示:

$(document).ready(function () {
    $("#question").each(function() { 
        $(this).qtip({
            content: 'Dark themes are all the rage!',
            style: { 
                name: 'dark' // Inherit from preset style
            }
            show: 'mouseover',
            hide: 'mouseout'
       });
   });
});

不太确定隐藏/显示选项是否正确。