单击时,jquery滚动到模式窗口底部

在一个模式窗口中,我有一个打开和关闭的div。打开时,我需要将模式窗口滚动到底部。如何做到这一点?通常的方法都不会滚动模式窗口。

jQuery(document).ready(function ($) {

    $('.item-wrapper').hide();

    $(".item-toggler").click(function() {

        $(this).parent().find(".item-wrapper").toggle();

        // none of these scroll the modal window to the bottom 

        // $('#modal-body-content').animate({ scrollTop: 300 }, 500);

        // $("#modal-body-content").scrollTop(900);

        // $('html, body, .modal-body').stop().animate({ scrollTop: 500 }, 500, 'easeInOutExpo');

    });

});


<div class="modal-body" id="modal-body-content">

    <div class="item-wrapper"> a lot of content here </div>

    <div class="item-toggler">show the content and scroll to bottom of modal window</div>

</div>

转载请注明出处:http://www.0591kyj.com/article/20230526/992099.html