ok
Direktori : /home/pequenacapitolio/www/js/libs/ |
Current File : /home/pequenacapitolio/www/js/libs/theia-sticky-sidebar.min.js |
!function(i){i.fn.theiaStickySidebar=function(t){var o,a,e,d,n,s;function r(t,o){return!0===t.initialized||!(i("body").width()<t.minWidth)&&(e=o,(a=t).initialized=!0,i("head").append(i('<style>.theiaStickySidebar:after {content: ""; display: table; clear: both;}</style>')),e.each(function(){var t={};if(t.sidebar=i(this),t.options=a||{},t.container=i(t.options.containerSelector),0==t.container.length&&(t.container=t.sidebar.parent()),t.sidebar.parents().css("-webkit-transform","none"),t.sidebar.css({position:"relative",overflow:"visible","-webkit-box-sizing":"border-box","-moz-box-sizing":"border-box","box-sizing":"border-box"}),t.stickySidebar=t.sidebar.find(".theiaStickySidebar"),0==t.stickySidebar.length){var o=/(?:text|application)\/(?:x-)?(?:javascript|ecmascript)/i;t.sidebar.find("script").filter(function(i,t){return 0===t.type.length||t.type.match(o)}).remove(),t.stickySidebar=i("<div>").addClass("theiaStickySidebar").append(t.sidebar.children()),t.sidebar.append(t.stickySidebar)}t.marginTop=parseInt(t.sidebar.css("margin-top")),t.marginBottom=parseInt(t.sidebar.css("margin-bottom")),t.paddingTop=parseInt(t.sidebar.css("padding-top")),t.paddingBottom=parseInt(t.sidebar.css("padding-bottom"));var e,d,n=t.stickySidebar.offset().top,s=t.stickySidebar.outerHeight();function r(){t.fixedScrollTop=0,t.sidebar.css({"min-height":"1px"}),t.stickySidebar.css({position:"static",width:""})}t.stickySidebar.css("padding-top",1),t.stickySidebar.css("padding-bottom",1),n-=t.stickySidebar.offset().top,s=t.stickySidebar.outerHeight()-s-n,0==n?(t.stickySidebar.css("padding-top",0),t.stickySidebarPaddingTop=0):t.stickySidebarPaddingTop=1,0==s?(t.stickySidebar.css("padding-bottom",0),t.stickySidebarPaddingBottom=0):t.stickySidebarPaddingBottom=1,t.previousScrollTop=null,t.fixedScrollTop=0,r(),t.onScroll=function(t){if(t.stickySidebar.is(":visible"))if(i("body").width()<t.options.minWidth)r();else{if(t.options.disableOnResponsiveLayouts){var o=t.sidebar.outerWidth("none"==t.sidebar.css("float"));if(o+50>t.container.width())return void r()}var e,d,n=i(document).scrollTop(),s="static";if(n>=t.container.offset().top+(t.paddingTop+t.marginTop-t.options.additionalMarginTop)){var c,p=t.paddingTop+t.marginTop+a.additionalMarginTop,b=t.paddingBottom+t.marginBottom+a.additionalMarginBottom,l=t.container.offset().top,g=t.container.offset().top+(e=t.container,d=e.height(),e.children().each(function(){d=Math.max(d,i(this).height())}),d),h=0+a.additionalMarginTop,f=t.stickySidebar.outerHeight()+p+b<i(window).height();c=f?h+t.stickySidebar.outerHeight():i(window).height()-t.marginBottom-t.paddingBottom-a.additionalMarginBottom;var S=l-n+t.paddingTop+t.marginTop,m=g-n-t.paddingBottom-t.marginBottom,y=t.stickySidebar.offset().top-n,u=t.previousScrollTop-n;"fixed"==t.stickySidebar.css("position")&&"modern"==t.options.sidebarBehavior&&(y+=u),"stick-to-top"==t.options.sidebarBehavior&&(y=a.additionalMarginTop),"stick-to-bottom"==t.options.sidebarBehavior&&(y=c-t.stickySidebar.outerHeight()),y=u>0?Math.min(y,h):Math.max(y,c-t.stickySidebar.outerHeight()),y=Math.max(y,S),y=Math.min(y,m-t.stickySidebar.outerHeight());var k=t.container.height()==t.stickySidebar.outerHeight();s=!k&&y==h||!k&&y==c-t.stickySidebar.outerHeight()?"fixed":n+y-t.sidebar.offset().top-t.paddingTop<=a.additionalMarginTop?"static":"absolute"}if("fixed"==s)t.stickySidebar.css({position:"fixed",width:t.sidebar.width(),top:y,left:t.sidebar.offset().left+parseInt(t.sidebar.css("padding-left"))});else if("absolute"==s){var v={};"absolute"!=t.stickySidebar.css("position")&&(v.position="absolute",v.top=n+y-t.sidebar.offset().top-t.stickySidebarPaddingTop-t.stickySidebarPaddingBottom),v.width=t.sidebar.width(),v.left="",t.stickySidebar.css(v)}else"static"==s&&r();"static"!=s&&1==t.options.updateSidebarHeight&&t.sidebar.css({"min-height":t.stickySidebar.outerHeight()+t.stickySidebar.offset().top-t.sidebar.offset().top+t.paddingBottom}),t.previousScrollTop=n}},t.onScroll(t),i(document).scroll((e=t,function(){e.onScroll(e)})),i(window).resize((d=t,function(){d.stickySidebar.css({position:"static"}),d.onScroll(d)}))}),!0);var a,e}(t=i.extend({containerSelector:"",additionalMarginTop:0,additionalMarginBottom:0,updateSidebarHeight:!0,minWidth:0,disableOnResponsiveLayouts:!0,sidebarBehavior:"modern"},t)).additionalMarginTop=parseInt(t.additionalMarginTop)||0,t.additionalMarginBottom=parseInt(t.additionalMarginBottom)||0,r(o=t,a=this)||(console.log("TST: Body width smaller than options.minWidth. Init is delayed."),i(document).scroll((n=o,s=a,function(t){var o=r(n,s);o&&i(this).unbind(t)})),i(window).resize((e=o,d=a,function(t){var o=r(e,d);o&&i(this).unbind(t)})))}}(jQuery);