Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(window).on('scroll', function(){
- // in percentage
- //$('#custom-scrollbar-thumb').css('top', -$(window).scrollTop() / ($(window).height() - $('body')[0].scrollHeight) * 100 +'%' );
- // in pixels
- $('#custom-scrollbar-thumb').css('top', $(window).scrollTop() * ($(window).scrollTop() / $('body')[0].scrollHeight) +'px' );
- });
- $(window).on('resize', function(){
- $('#custom-scrollbar-thumb').css('height', window.innerHeight * (window.innerHeight / document.body.offsetHeight) +'px' );
- });
Add Comment
Please, Sign In to add comment