此JS就是DIV不分随的屏幕而滚动。

<script type="text/javascript">
    $(document).ready(function () {
        var menuYloc = $("#comment-overlay").offset().top; //此ID为随着屏幕滚动div的ID
        $(window).scroll(function () {
            var offsetTop = menuYloc + $(window).scrollTop() + "px";
            $("#comment-overlay").animate({ top: offsetTop }, { duration: 600, queue: false }); //此ID为随着屏幕滚动div的ID
        });
    });
</script>


<style>


.comment-overlay {

    position: absolute;

    left: 0;

    top: 0;

    width: 100%;

    height: 100%;

    display: flex;

    justify-content: center;

    align-items: center;

    background-color: rgba(255,255,255,.92);

    z-index: 9999999999999;

}

.comment-overlay-login {

    text-align: center;

    font-size: 30px;

}

.comment-overlay-login p {

    margin-bottom: 20px;

}

</style>

<div class="comment-overlay" id="comment-overlay">                           


<div class="comment-overlay-login"><p>内容 </p></div> </div></div>