jquery工具提示和对话框

时间:2010-11-01 03:46:35

标签: jquery tooltip

我正在使用jQuery Tools Tooltip(http://flowplayer.org/tools/tooltip/index.html),我正在尝试让动态插件工作。如果你设置它的位置在屏幕之外,它会改变工具提示的位置(如果它被屏幕顶部切掉,它将显示在工具提示所属的元素下面)。

理想情况下,我想在jQuery对话框中复制它,这样如果标题栏切断了工具提示,它将显示在它所属的元素下面。

或者,我希望工具提示显示在标题栏的顶部。我尝试将工具提示的z-index设置为999999999999,但它仍然出现在标题栏下方。

任何想法,Stack?

3 个答案:

答案 0 :(得分:0)

This question可能有助于使用z-index。您尝试的值大于允许的最大值。

答案 1 :(得分:0)

您是否在样式中提供了position属性?如果要使用z-index,则必须先设置position属性。

答案 2 :(得分:0)

问题不在于z-index或position属性,而在于溢出。工具提示与'auto'不兼容,但它确实与'visible'一起使用。但是,使用'overflow:visible;'你丢失了窗户上的自动滚动条,这是不受欢迎的。所以最好的解决方案是让动态工具提示插件处理父.ui-dialog-content div维度,而不是窗口维度。

function getCropping(el) {
    var w = $(el).closest('.ui-dialog-content');
    var right = w.offset().left + w.width();
    var bottom = w.offset().top + w.height();
    var toolTipRight = el.offset().left + el.width();
    var toolTipBottom = el.offset().top + el.height();

    return [
        el.offset().top <= w.offset().top,                      // top
        right <= toolTipRight,          // right
        bottom <= toolTipBottom,        // bottom
        w.offset().left >= el.offset().left                     // left
    ];
}