Theia Sticky Sidebar
Glues your website's sidebars (or any vertical column for that matter), making them permanently visible when scrolling up and down. Useful when a sidebar is too tall or too short compared to the rest of the content. Works with virtually any design and supports multiple sidebars.
Also available as a WordPress plugin that comes with a user-friendly admin panel.
Check out these examples:
3 columns example
4 columns example
Bootstrap 4 example
BowerIf you are using Bower as your package manager:
bower install theia-sticky-sidebar
NPMIf you are using NPM as your package manager:
npm install theia-sticky-sidebar
UsageYour website's HTML structure has to be similar to this in order to work:
<div class="wrapper"> <div class="content"> <div class="theiaStickySidebar"> ... </div> </div> <div class="sidebar"> <div class="theiaStickySidebar"> ... </div> </div> </div>
Note that the inner "theiaStickySidebar" divs are optional, but highly recommended. If you don't supply them yourself, the script will create them for you, but this can be problematic if you're using ads or iframes, since they will be moved around in the DOM and as a result will get reloaded.
ResizeSensorTheia Sticky Sidebar uses the CSS Element Queries library to detect when your sidebars change height, so that it can recalculate their positions. This can happen if you are using an accordion, for example.
You can choose not to include the
ResizeSensor.min.jsscript in your page, in which case Theia Sticky Sidebar will continue to function (possibly even a bit smoother) but will not automatically detect height changes.
containerSelectorThe sidebar's container element. If not specified, it defaults to the sidebar's parent.
additionalMarginTopAn additional top margin in pixels. Defaults to 0.
additionalMarginBottomAn additional bottom margin in pixels. Defaults to 0.
updateSidebarHeightUpdates the sidebar's height. Use this if the background isn't showing properly, for example. Defaults to true.
minWidthThe sidebar returns to normal if its width is below this value. Useful for responsive designs. Defaults to 0.
defaultPositionThe sidebar must have a non-static
position, as the inner sticky-sidebar uses
position: absolute. Defaults to relative.