Team:NCTU Formosa/source/stickyrelocate

function sticky_relocate() {

           var window_top = $(window).scrollTop();
           var div_top = $('#sticky-anchor').offset().top;
           if (window_top > div_top) {
               $('#sidenav').addClass('stick');
           } else {
               $('#sidenav').removeClass('stick');
           }
       }
       
       $(function () {
           $(window).scroll(sticky_relocate);
           sticky_relocate();
       });