diff --git a/_layouts/docs.html b/_layouts/docs.html index a324bc2906..9072c9db0d 100644 --- a/_layouts/docs.html +++ b/_layouts/docs.html @@ -192,19 +192,23 @@ else %}{% assign edit_url = "" %}{% endif %} {% break %} {% endif %} {% endfor % + diff --git a/css/temp.css b/css/temp.css index 13792f9810..80767362ce 100644 --- a/css/temp.css +++ b/css/temp.css @@ -39,3 +39,26 @@ margin-top: 20px; margin-bottom: 20px; } + +/* Archive butterbar */ +#archive-butterbar { + padding-top: 10px; + padding-bottom: 10px; + min-height: 34px; + border: 1px solid #254356; + background-color: #FFE1C0; + color: #254356; + width: 100%; + z-index: 9999; +} + +#archive-butterbar.top { + position: relative; + margin-top: 0; +} + +/* Archive butterbar when the top nav is fixed */ +#archive-butterbar.fixed { + position: fixed; + top: 55px; +} diff --git a/js/archive.js b/js/archive.js index 2eca2d038e..d4fae1cff6 100644 --- a/js/archive.js +++ b/js/archive.js @@ -2,8 +2,8 @@ if (window.navigator.onLine) { var dockerVersion = 'v17.03'; /* This JSON file contains a current list of all docs versions of Docker */ - $.getJSON("https://docs.docker.com/js/archives.json", function(result){ - var outerDivStart = '
This is archived documentation for Docker ' + dockerVersion + '. Go to the latest docs or a different version:  ' + + $.getJSON("/js/archives.json", function(result){ + var outerDivStart = '
This is archived documentation for Docker ' + dockerVersion + '. Go to the latest docs or a different version:  ' + ''; var listStart = ''; @@ -23,5 +23,17 @@ if (window.navigator.onLine) { } }); $( 'body' ).prepend(outerDivStart + buttonCode + listStart + listItems.join("") + listEnd + outerDivEnd); + hasButterBar = true; + // If the butterbar exists, deal with positioning it + // Depends on some logic in _layout/docs.html + $(document).scroll(function() { + if ( $( 'nav' ).hasClass( 'affix' ) ) { + $('#archive-butterbar').addClass('fixed').removeClass('top'); + console.log("Fixed!"); + } else { + $('#archive-butterbar').addClass('top').removeClass('fixed'); + console.log("Top!"); + } + }); }); -} \ No newline at end of file +} diff --git a/js/docs.js b/js/docs.js index 2a45fbb80c..d637310852 100644 --- a/js/docs.js +++ b/js/docs.js @@ -286,6 +286,9 @@ $(function () { $('[data-toggle="tooltip"]').tooltip() }) +// Enable glossary link popovers +$('.glossLink').popover(); + // sync tabs with the same data-group window.onload = function() { $('.nav-tabs > li > a').click(function(e) { @@ -293,5 +296,3 @@ window.onload = function() { $('.nav-tabs > li > a[data-group="'+ group +'"]').tab('show'); }) }; - -$('.glossLink').popover();