简体   繁体   English

如何防止滚动直到加载完所有图像

[英]How To Prevent Scrolling Until All images are loaded

The scrollbar cannot scroll to the bottom due to some images not being loaded. 由于未加载某些图像,因此滚动条无法滚动到底部。 How can I update the scrollbar when all the images are loaded? 加载所有图像后如何更新滚动条? Appreciate no matter using JavaScript or jQuery. 无论使用JavaScript还是jQuery都可以欣赏。

<div class="scrollbar">
    <div class="thumb noSelect" unselectable="on"><div class="end">
</div></div></div>
<div class="viewport">
    <div class="overview">
        <ul class="pinkarrow">
            ......
            </div>
        </ul>
    </div>
</div>

First add overflow: hidden to scrollbar. 首先添加overflow: hidden到滚动条。

Then add following jQuery code to show your scrollbar when images are loaded: 然后添加以下jQuery代码以在加载图像时显示滚动条:

(function($) {
  $(window).load(function() {
    $('.scrollbar').css('overflow', 'auto');
  });
})(jQuery);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM