Template:USTC-Software/js/addScrollBar

$(document).ready(function () {

   // add the div we want to use
$('#content').append('
' +
       '<img src="T--USTC-Software--scroll.png"/>' +
'
' + '
');
   // basic operation
   let show = false;
   $(window).scroll(function () {
       let toTop = $(document).scrollTop();
       if (toTop > 300 && !show){
           $(".scroll").css("bottom", "5%");
           console.log('gt 300px');
           show = true;
       }else if(toTop <= 300 && show){
           $(".scroll").css("bottom", "100%");
           console.log('lt 300px');
           show = false;
       }
   });
   // make the img clickable
   $('.backHead').on('click', function () {
       $('body, html').animate({
           scrollTop: 0,
           screenLeft: 0
       }, 300);
       $(".scroll").css("bottom", "100%");
   });

});