Animate Height Bottom to Top Instead of Top to Bottom

后端 未结 3 1192
暖寄归人
暖寄归人 2021-01-23 02:40

How can I achieve height animation in reverse?

Instead of the typical animation starting from the top and working its way down, how can I have it start the animation fr

相关标签:
3条回答
  • 2021-01-23 03:24
    position: absolute;
    bottom: 0px;
    

    animate bottom + 1.

    You can also use negative values for top or margin-top to move upwards.

    0 讨论(0)
  • 2021-01-23 03:25

    Animate as you would for top-to-bottom, but add element.scrollTop = 99999;

    This will ensure that the bottom of the content is visible (unless for some reason it's 100,000 pixels tall) and the effect will be bottom-to-top animation.

    0 讨论(0)
  • 2021-01-23 03:32

    You div and your a tags have the same ID. They must have unique IDs.

    $('a#line-1').click(function() {
        $('div#line-1').animate({
    

    needs to be something like:

    $('a#line-1').click(function() {
        $('div#unique_id').animate({
    

    Example Fix

    0 讨论(0)
提交回复
热议问题