Skip to content
liaofeiyin edited this page May 27, 2017 · 5 revisions

Welcome to the vue_blog wiki!

jQuery 设置顶部state-bar的长度

随着页面滚动而变化

document.body.onscroll = function() {
        var height = $(document).height();
        var winH = $(window).height();
        var scrollTop = $(window).scrollTop();
        $('.state-bar').width(scrollTop/(height-winH) *100 +'%');
}
Clone this wiki locally