MediaWiki:StickyRail/code.js

/** * StickyRail * Make WikiaRail stick to the top and scroll along with the screen * Make the height of WikiaRail suitable for screen **/ function ResizeRail { var RailHeight, ContentHeight = $('#WikiaMainContent').height, WindowHeight = $(window).height - $('#WikiaBarWrapper').height - $('#globalNavigation').height; if ( ContentHeight < WindowHeight ) { RailHeight = ContentHeight; } else { RailHeight = WindowHeight; } $('#WikiaRail').css({    'height' : RailHeight,    'position' : 'sticky',    'top' : $('#globalNavigation').height,    'overflow' : 'auto',    'margin-top' : '8px',    'margin-bottom' : '8px'  }); } $(window).load(ResizeRail).resize(ResizeRail);