/*! * Theia Sticky Sidebar v1.2.2 * https://github.com/WeCodePixels/theia-sticky-sidebar * * Glues your website's sidebars, making them permanently visible while scrolling. * * Copyright 2013-2014 WeCodePixels and other contributors * Released under the MIT license */ ( function ( $ ) { $.fn.theiaStickySidebar = function ( options ) { var defaults = { 'containerSelector': '', 'additionalMarginTop': 0, 'additionalMarginBottom': 0, 'updateSidebarHeight': true, 'minWidth': 0 }; options = $.extend( defaults, options ); // Validate options options.additionalMarginTop = parseInt( options.additionalMarginTop ) || 0; options.additionalMarginBottom = parseInt( options.additionalMarginBottom ) || 0; // Add CSS $( 'head' ).append( $( '' ) ); this.each( function () { var o = { }; o.sidebar = $( this ); // Save options o.options = options || { }; // Get container o.container = $( o.options.containerSelector ); if ( o.container.size() == 0 ) { o.container = o.sidebar.parent(); } // Create sticky sidebar o.sidebar.parents().css( '-webkit-transform', 'none' ); // Fix for WebKit bug - https://code.google.com/p/chromium/issues/detail?id=20574 o.sidebar.css( { 'position': 'relative', 'overflow': 'visible', // The "box-sizing" must be set to "content-box" because we set a fixed height to this element when the sticky sidebar has a fixed position. '-webkit-box-sizing': 'border-box', '-moz-box-sizing': 'border-box', 'box-sizing': 'border-box' } ); // Get the sticky sidebar element. If none has been found, then create one. o.stickySidebar = o.sidebar.find( '.theiaStickySidebar' ); if ( o.stickySidebar.length == 0 ) { o.sidebar.find( 'script' ).remove(); // Remove