当父div在屏幕上不可见时的jQuery UI位置函数问题

问题描述:

我在使用jQuery UI Position Function时遇到了一个奇怪的问题.

I'm facing a weird problem with jQuery UI Position function.

有一个父div,其大小大于屏幕的高度,而在其内部又有一个小div. 我的函数告诉小div位于父对象的底部.

There is a parent div, bigger then screen's height and another small div inside it. My function tell to the small div be positioned in the bottom of it parent.

当底部可见时,一切正常,但是由于窗口大小而底部不可见时,位置功能不起作用.

When the bottom is visible, everything is ok, but when the bottom is not visible because of the window size, the position function doesnt work.

遵循抽奖以方便理解...

Follow a draw to make easy understanding...

我正在使用的函数是

    $("#_GREEN_div").position({
        of: $("#_RED_div"),
        my: "left bottom",
        at: "left bottom"
    });

:JSFiddle- jsfiddle.net/Steve_Wellens/5Zdac (感谢史蒂夫,很棒的工具)

JSFiddle - jsfiddle.net/Steve_Wellens/5Zdac (thanks Steve, great tool)

我认为您还应该使用碰撞属性:

I think you should use collision attribute also:

$("#_GREEN_div").position({
    of: $("#_RED_div"),
    my: "left bottom",
    at: "left bottom",
    collision: 'none'
});

这样,"MY DIV"将始终位于左下角.

This way "MY DIV" will always be at the bottom left.