Difference between revisions of "Template:USTC-Software/js/makeIndexFixed"

(Created page with "$(document).ready(function () { $(window).scroll(function (ev) { let top = $(document).scrollTop(); let menuTop = $('.autoMenu').offset().top; console....")
 
Line 3: Line 3:
 
       let top = $(document).scrollTop();
 
       let top = $(document).scrollTop();
 
       let menuTop = $('.autoMenu').offset().top;
 
       let menuTop = $('.autoMenu').offset().top;
       console.log(top, menuTop);
+
       //console.log(top, menuTop);
 
       if(menuTop <= top){
 
       if(menuTop <= top){
           console.log('is disappearing');
+
           //console.log('is disappearing');
 
           $('.autoMenu').css({
 
           $('.autoMenu').css({
 
               "position": "fixed",
 
               "position": "fixed",
               "top": "16px",
+
               "top": "60px",
 
               // "left": "1em"
 
               // "left": "1em"
 
           });
 
           });

Revision as of 11:56, 3 October 2019

$(document).ready(function () {

  $(window).scroll(function (ev) {
      let top = $(document).scrollTop();
      let menuTop = $('.autoMenu').offset().top;
      //console.log(top, menuTop);
      if(menuTop <= top){
          //console.log('is disappearing');
          $('.autoMenu').css({
              "position": "fixed",
              "top": "60px",
              // "left": "1em"
          });
      }
  });

});