Difference between revisions of "Team:Uppsala/test5"

(Undo revision 334428 by Mk3johnson (talk))
Line 378: Line 378:
 
     var scrollTop = $(window).scrollTop();
 
     var scrollTop = $(window).scrollTop();
 
              
 
              
     if (sidebarTop < scrollTop) {
+
      
      stickySidebar.css('top', scrollTop - sidebarTop);
+
 
+
      // stop the sticky sidebar at the footer to avoid overlapping
+
      var sidebarBottom = stickySidebar.offset().top + stickyHeight,
+
          stickyStop = $('.main-content').offset().top + $('.main-content').height();
+
      if (stickyStop < sidebarBottom) {
+
        var stopPosition = $('.main-content').height() - stickyHeight;
+
        stickySidebar.css('top', stopPosition);
+
      }
+
    }
+
    else {
+
      stickySidebar.css('top', '0');
+
    }
+
 
   }
 
   }
 
});
 
});

Revision as of 20:42, 15 October 2018




Uppsala iGEM 2018