jQuery 工具提示 - 如何声明 2 个选项

标签 jquery css jquery-ui tooltip

我一直在我的网站上使用工具提示:

<a title="Help: jQuery UI's theme builder application">Help</a>

在 i.JS 中,我想使用位置和显示选项:

    $( document ).tooltip({     
    show: {
        effect: "slideDown",
        delay: 150,
        track: true
    }       
 });

$( document ).tooltip({
    position: {
        my: "center bottom-20",
        at: "center top",
        using: function( position, feedback ) {
            $( this ).css( position );
            $( "<div>" )
            .addClass( "arrow" )
            .addClass( feedback.vertical )
            .addClass( feedback.horizontal )
            .appendTo( this );
        }
    }
});

CSS:

.ui-tooltip, .arrow:after {
  background: #9FDAEE; 
  border: 1px solid #2BB0D7;
}
.ui-tooltip {
 margin-left: -999em;
 position: absolute;
 border-radius: 5px 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; 
 box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 5px 5px rgba(0, 0, 0, 0.1); -moz-box-shadow: 5px 5px rgba(0, 0, 0, 0.1);
 font-family: Calibri, Tahoma, Geneva, sans-serif;
 position: absolute; left: 1em; top: 2em; z-index: 99;
 margin-left: 0; width: 250px;
 font-family: Candara, Tahoma, Geneva, sans-serif; font-size: 1.2em; font-weight: bold;
 display: block; padding: 0.2em 0 0.6em 0;
}
.arrow {
 width: 70px;
 height: 16px;
 overflow: hidden;
 position: absolute;
 left: 50%;
 margin-left: -35px;
 bottom: -16px;
}
.arrow.top {
 top: -16px;
 bottom: auto;
}
.arrow.left {
 left: 20%;
}
.arrow:after {
 content: "";
 position: absolute;
 left: 20px;
 top: -20px;
 width: 25px;
 height: 25px;
 box-shadow: 6px 5px 9px -9px black;
 -webkit-transform: rotate(45deg);
 -moz-transform: rotate(45deg);
 -ms-transform: rotate(45deg);
 -o-transform: rotate(45deg);
 tranform: rotate(45deg);
}
.arrow.top:after {
  bottom: -20px;
  top: auto;
}

我如何一起使用它们?

另外,我目前正在使用slideDown功能,有'slideRight'版本吗?

谢谢

最佳答案

//像这样尝试,希望它能成功

$( document ).tooltip({     
    show: {
        effect: "slideDown",
        delay: 150,
        track: true
    },

    position: {
        my: "center bottom-20",
        at: "center top",
        using: function( position, feedback ) {
            $( this ).css( position );
            $( "<div>" )
            .addClass( "arrow" )
            .addClass( feedback.vertical )
            .addClass( feedback.horizontal )
            .appendTo( this );
        }
    }       
 });

关于jQuery 工具提示 - 如何声明 2 个选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17614188/

相关文章:

javascript - 如何打开页面并滚动到特定位置

jquery - 在客户端的 jqGrid 中编辑数据,然后批量发送到服务器?

javascript - 为什么 JavaScript 中的日期操作很奇怪

javascript - 使用 jquery 检索属性值

html - 在 bootstrap 2.3.2 行中居中两个 div

html - Bootstrap 导航栏右侧的语言选择器

html - 如何设置 bootstrap 4 元素的样式?

jquery - 使用 jquery click 函数来定位带有 jquery show/hide 的链接在 firefox 和 ie 中不起作用,但在 safari 中起作用

javascript - jQuery UI 选项卡 - 锚定到内部链接

javascript - 如何修复: Dragged element not shown