jQueryslideDown和slideUp函数非常方便,但我需要稍微改变它们的行为。
它能做什么
当您调用slideDowna时,通常会发生divdiv 向下滑动,并且随着它进一步向下滑动,显示较低的内容div。
我需要它做什么
我希望div向下滑动,但不应显示 的下部内容,而div应显示上部内容。所以最底部的内容应该首先可见,然后上面的内容应该滑入视图。这样做的目的是让它div看起来像是从屏幕外滑到屏幕上的。这是一个图表:
How it works now:
----------
| Line 1 | |  Reveals from top to bottom; top is anchored in place
| Line 2 | |  As the div expands vertically, Line 1 is shown first and
| Line 3 | |  none of the lines move as they become visible.
********** V
| Line 4 | 
| Line 5 |
----------
How I would like it to work:
----------
| Line 1 |    
| Line 2 |    
| Line 3 |    
********** ^  Reveals from bottom to top; bottom is anchored in place
| Line 4 | |  As the div expands vertically, the Line 5 is shown first and
| Line 5 | |  moves downward as more is revealed.
----------
我意识到我可能无法有效地沟通,如果您需要更多说明,请告诉我。
更新:
这是与我正在使用的 HTML 等效的 HTML:
<div id="anchored">
    <table>
        <tr>
            <td>
                <!-- this is the div that is initially invisible and should slide from the bottom -->
                <div id="slider">
                    hello
                </div>
            </td>
        </tr>
        <tr>
            <td>
            <!-- this is always visible and should be pushed down by "slider" as it moves downward -->
            hello 
            </td>
        </tr>
    </table>
</div>
CSS:
#anchored {
    position: fixed;
    top: 0px;
}
#slider {
    display: none;
}
table {
    width: 100%;
}