Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
406 views
in Technique[技术] by (71.8m points)

html - Scroll come back to top after auto scrolling to bottom

I have an issue with scrolling to the bottom of div.

After I auto scroll to the bottom to the div when page load, the scroll comes back to the top automatically !

<div class="scroll-area-md" id="chatBox">
    <div class="scrollbar-container">
        <div class="chat-wrapper p-1">
                <div class="chat-box-wrapper">
                    <div>
                        <div class="avatar-icon-wrapper mr-1">
                            <div class="avatar-icon avatar-icon-lg rounded">
                                <img src="'/public/uploads/anyProfile.png?>" alt="">
                            </div>
                        </div>
                    </div>
                    <div>
                        <small class="opacity-6">
                            <i class="fa fa-user-circle-o mr-1"></i>
                            Username: AAA
                        </small>
                        <div class="chat-box">Message space</div>
                        <small class="float-right">
                            <span class="opacity-6">
                                <i class="fa fa-calendar-alt mr-1"></i>
                                10/10/2020
                            </span> &nbsp; &nbsp;
                        </small>
                    </div>
                </div>
        </div>
    </div>
</div>


    <script>
$( document ).ready(function() {

   $("#chatBox"). animate({ scrollTop: $(document). height() }, "slow?"); return false;

});
</script>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...