diff --git a/layouts/partials/script_includes.html b/layouts/partials/script_includes.html index c37a412088..45ddcb8520 100644 --- a/layouts/partials/script_includes.html +++ b/layouts/partials/script_includes.html @@ -1,6 +1,7 @@ + diff --git a/static/css/hugo-theme.css b/static/css/hugo-theme.css index 1b715debb1..1179113c40 100644 --- a/static/css/hugo-theme.css +++ b/static/css/hugo-theme.css @@ -1,22 +1,5 @@ /* Insert here special css for hugo theme, on top of any other imported css */ -/* -.progress { - position: relative; - float: top; - text-align: left; - width: 330px; - padding: 45px 0 0 2%; -} -.progress .wrapper { - position: absolute; - width: inherit; -} -.progress .wrapper.affix { - position: fixed; - top: 10px; - -}*/ /* Table of contents */ @@ -45,7 +28,7 @@ width: auto; border: thin solid #ECECEC; display:none; - z-index:200; + z-index:200; } #toc-menu { @@ -53,3 +36,11 @@ padding-right: 1rem !important; margin-right: 0.5rem !important; } + +#top-bar { + z-index: 1000; +} + +#top-bar.is_stuck { + box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1); +} diff --git a/static/js/hugo-learn.js b/static/js/hugo-learn.js index 7ada2f9f27..d8a98f2205 100644 --- a/static/js/hugo-learn.js +++ b/static/js/hugo-learn.js @@ -62,3 +62,5 @@ $('#toc-menu').hover(function() { $('.progress').hover(function() { $('.progress').stop(true, false, true).fadeToggle(300); }); + +$("#top-bar").stick_in_parent(); diff --git a/static/js/jquery.sticky-kit.min.js b/static/js/jquery.sticky-kit.min.js new file mode 100644 index 0000000000..e2a3c6de9e --- /dev/null +++ b/static/js/jquery.sticky-kit.min.js @@ -0,0 +1,9 @@ +/* + Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | http://leafo.net +*/ +(function(){var b,f;b=this.jQuery||window.jQuery;f=b(window);b.fn.stick_in_parent=function(d){var A,w,J,n,B,K,p,q,k,E,t;null==d&&(d={});t=d.sticky_class;B=d.inner_scrolling;E=d.recalc_every;k=d.parent;q=d.offset_top;p=d.spacer;w=d.bottoming;null==q&&(q=0);null==k&&(k=void 0);null==B&&(B=!0);null==t&&(t="is_stuck");A=b(document);null==w&&(w=!0);J=function(a,d,n,C,F,u,r,G){var v,H,m,D,I,c,g,x,y,z,h,l;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);I=A.height();g=a.parent();null!=k&&(g=g.closest(k)); +if(!g.length)throw"failed to find stick parent";v=m=!1;(h=null!=p?p&&a.closest(p):b("
"))&&h.css("position",a.css("position"));x=function(){var c,f,e;if(!G&&(I=A.height(),c=parseInt(g.css("border-top-width"),10),f=parseInt(g.css("padding-top"),10),d=parseInt(g.css("padding-bottom"),10),n=g.offset().top+c+f,C=g.height(),m&&(v=m=!1,null==p&&(a.insertAfter(h),h.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(t),e=!0),F=a.offset().top-(parseInt(a.css("margin-top"),10)||0)-q, +u=a.outerHeight(!0),r=a.css("float"),h&&h.css({width:a.outerWidth(!0),height:u,display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":r}),e))return l()};x();if(u!==C)return D=void 0,c=q,z=E,l=function(){var b,l,e,k;if(!G&&(e=!1,null!=z&&(--z,0>=z&&(z=E,x(),e=!0)),e||A.height()===I||x(),e=f.scrollTop(),null!=D&&(l=e-D),D=e,m?(w&&(k=e+u+c>C+n,v&&!k&&(v=!1,a.css({position:"fixed",bottom:"",top:c}).trigger("sticky_kit:unbottom"))),e