File: /home/aprilnet/public_html/meadcarney.com/wp-content/themes/malina/js/theia-sticky-sidebar.js
!function(a){a.fn.theiaStickySidebar=function(b){function d(b,c){var d=e(b,c);d||(console.log("TSS: Body width smaller than options.minWidth. Init is delayed."),a(document).scroll(function(b,c){return function(d){var f=e(b,c);f&&a(this).unbind(d)}}(b,c)),a(window).resize(function(b,c){return function(d){var f=e(b,c);f&&a(this).unbind(d)}}(b,c)))}function e(b,c){return b.initialized===!0||!(a("body").width()<b.minWidth)&&(f(b,c),!0)}function f(b,c){b.initialized=!0,a("head").append(a('<style>.theiaStickySidebar:after {content: ""; display: table; clear: both;}</style>')),c.each(function(){function h(){c.fixedScrollTop=0,c.sidebar.css({"min-height":"1px"}),c.stickySidebar.css({position:"static",width:"",transform:"none"})}function i(b){var c=b.height();return b.children().each(function(){c=Math.max(c,a(this).height())}),c}var c={};if(c.sidebar=a(this),c.options=b||{},c.container=a(c.options.containerSelector),0==c.container.length&&(c.container=c.sidebar.parent()),c.sidebar.parents().css("-webkit-transform","none"),c.sidebar.css({position:"relative",overflow:"visible","-webkit-box-sizing":"border-box","-moz-box-sizing":"border-box","box-sizing":"border-box"}),c.stickySidebar=c.sidebar.find(".theiaStickySidebar"),0==c.stickySidebar.length){var d=/(?:text|application)\/(?:x-)?(?:javascript|ecmascript)/i;c.sidebar.find("script").filter(function(a,b){return 0===b.type.length||b.type.match(d)}).remove(),c.stickySidebar=a("<div>").addClass("theiaStickySidebar").append(c.sidebar.children()),c.sidebar.append(c.stickySidebar)}c.marginBottom=parseInt(c.sidebar.css("margin-bottom")),c.paddingTop=parseInt(c.sidebar.css("padding-top")),c.paddingBottom=parseInt(c.sidebar.css("padding-bottom"));var e=c.stickySidebar.offset().top,f=c.stickySidebar.outerHeight();c.stickySidebar.css("padding-top",1),c.stickySidebar.css("padding-bottom",1),e-=c.stickySidebar.offset().top,f=c.stickySidebar.outerHeight()-f-e,0==e?(c.stickySidebar.css("padding-top",0),c.stickySidebarPaddingTop=0):c.stickySidebarPaddingTop=1,0==f?(c.stickySidebar.css("padding-bottom",0),c.stickySidebarPaddingBottom=0):c.stickySidebarPaddingBottom=1,c.previousScrollTop=null,c.fixedScrollTop=0,h(),c.onScroll=function(c){if(c.stickySidebar.is(":visible")){if(a("body").width()<c.options.minWidth)return void h();if(c.options.disableOnResponsiveLayouts){var d=c.sidebar.outerWidth("none"==c.sidebar.css("float"));if(d+50>c.container.width())return void h()}var e=a(document).scrollTop(),f="static";if(e>=c.sidebar.offset().top+(c.paddingTop-c.options.additionalMarginTop)){var o,j=c.paddingTop+b.additionalMarginTop,k=c.paddingBottom+c.marginBottom+b.additionalMarginBottom,l=c.sidebar.offset().top,m=c.sidebar.offset().top+i(c.container),n=0+b.additionalMarginTop,p=c.stickySidebar.outerHeight()+j+k<a(window).height();o=p?n+c.stickySidebar.outerHeight():a(window).height()-c.marginBottom-c.paddingBottom-b.additionalMarginBottom;var q=l-e+c.paddingTop,r=m-e-c.paddingBottom-c.marginBottom,s=c.stickySidebar.offset().top-e,t=c.previousScrollTop-e;"fixed"==c.stickySidebar.css("position")&&"modern"==c.options.sidebarBehavior&&(s+=t),"stick-to-top"==c.options.sidebarBehavior&&(s=b.additionalMarginTop),"stick-to-bottom"==c.options.sidebarBehavior&&(s=o-c.stickySidebar.outerHeight()),s=t>0?Math.min(s,n):Math.max(s,o-c.stickySidebar.outerHeight()),s=Math.max(s,q),s=Math.min(s,r-c.stickySidebar.outerHeight());var u=c.container.height()==c.stickySidebar.outerHeight();f=(u||s!=n)&&(u||s!=o-c.stickySidebar.outerHeight())?e+s-c.sidebar.offset().top-c.paddingTop<=b.additionalMarginTop?"static":"absolute":"fixed"}if("fixed"==f){var v=a(document).scrollLeft();c.stickySidebar.css({position:"fixed",width:g(c.stickySidebar)+"px",transform:"translateY("+s+"px)",left:c.sidebar.offset().left+parseInt(c.sidebar.css("padding-left"))-v+"px",top:"0px"})}else if("absolute"==f){var w={};"absolute"!=c.stickySidebar.css("position")&&(w.position="absolute",w.transform="translateY("+(e+s-c.sidebar.offset().top-c.stickySidebarPaddingTop-c.stickySidebarPaddingBottom)+"px)",w.top="0px"),w.width=g(c.stickySidebar)+"px",w.left="",c.stickySidebar.css(w)}else"static"==f&&h();"static"!=f&&1==c.options.updateSidebarHeight&&c.sidebar.css({"min-height":c.stickySidebar.outerHeight()+c.stickySidebar.offset().top-c.sidebar.offset().top+c.paddingBottom}),c.previousScrollTop=e}},c.onScroll(c),a(document).scroll(function(a){return function(){a.onScroll(a)}}(c)),a(window).resize(function(a){return function(){a.stickySidebar.css({position:"static"}),a.onScroll(a)}}(c)),"undefined"!=typeof ResizeSensor&&new ResizeSensor(c.stickySidebar[0],function(a){return function(){a.onScroll(a)}}(c))})}function g(a){var b;try{b=a[0].getBoundingClientRect().width}catch(a){}return"undefined"==typeof b&&(b=a.width()),b}var c={containerSelector:"",additionalMarginTop:0,additionalMarginBottom:0,updateSidebarHeight:!0,minWidth:0,disableOnResponsiveLayouts:!0,sidebarBehavior:"modern"};b=a.extend(c,b),b.additionalMarginTop=parseInt(b.additionalMarginTop)||0,b.additionalMarginBottom=parseInt(b.additionalMarginBottom)||0,d(b,this)}}(jQuery);
function malina_fix_sidebar() {
if(jQuery('#header-main').hasClass('fixed_header')){
var marginTop = jQuery('#header').outerHeight() + jQuery("#wpadminbar").height() + 80;
} else {
var marginTop = jQuery("#wpadminbar").height() + 80;
}
var marginTop2 = jQuery('#header').outerHeight() + jQuery("#wpadminbar").height() + 92;
var mt = jQuery("#wpadminbar").height();
jQuery('#sidebar.sticky, #sidebar.vc_column_container, .sharebox-sticky').theiaStickySidebar({
// Settings
additionalMarginTop: marginTop
});
jQuery('#content .woocommerce .single-product .product .summary').theiaStickySidebar({
// Settings
additionalMarginTop: marginTop2
});
jQuery('.stick-this').theiaStickySidebar({
additionalMarginTop: mt
});
}
jQuery( document ).ready( function($) {
"use strict";
setTimeout(function(){ malina_fix_sidebar(); }, 100);
});