mirror of
https://github.com/docker/docs.git
synced 2026-03-27 14:28:47 +07:00
Fix archive butterbar margin-top
This commit is contained in:
committed by
Misty Stanley-Jones
parent
b2ba61aace
commit
ac5e6d72c0
@@ -192,19 +192,23 @@ else %}{% assign edit_url = "" %}{% endif %} {% break %} {% endif %} {% endfor %
|
||||
<script defer src="/js/menu.js"></script>
|
||||
<script src="/js/jquery.js"></script>
|
||||
<script src="/js/bootstrap.min.js"></script>
|
||||
<script language="javascript">
|
||||
// Assume there is no butterBar before loading the archive JS
|
||||
var hasButterBar = false;
|
||||
</script>
|
||||
<script src="/js/archive.js"></script>
|
||||
<script src="/js/stickyfill.min.js"></script>
|
||||
<script defer src="/js/docs.js"></script>
|
||||
<script language="javascript">
|
||||
jQuery(document).ready(function(){
|
||||
$.getJSON( "/metadata.txt", function( data ) {
|
||||
metadata = data;
|
||||
hookupTOCEvents();
|
||||
$.getJSON( "/glossary.txt", function( data ) {
|
||||
glossary = data;
|
||||
renderTagsPage();
|
||||
});
|
||||
$.getJSON( "/metadata.txt", function( data ) {
|
||||
metadata = data;
|
||||
hookupTOCEvents();
|
||||
$.getJSON( "/glossary.txt", function( data ) {
|
||||
glossary = data;
|
||||
renderTagsPage();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
23
css/temp.css
23
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;
|
||||
}
|
||||
|
||||
@@ -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 = '<div style="padding-top: 10px; padding-bottom: 10px; min-height: 34px; border: 1px solid #254356; background-color: #FFE1C0; color: #254356"><div class="container"><div style="text-align: center"><span id="archive-list">This is <b><a href="https://docs.docker.com/docsarchive/" style="color: #254356; text-decoration: underline !important">archived documentation</a></b> for Docker ' + dockerVersion + '. Go to the <a style="color: #254356; text-decoration: underline !important" href="https://docs.docker.com/">latest docs</a> or a different version: </span>' +
|
||||
$.getJSON("/js/archives.json", function(result){
|
||||
var outerDivStart = '<div id="archive-butterbar"><div class="container"><div style="text-align: center"><span id="archive-list">This is <b><a href="https://docs.docker.com/docsarchive/" style="color: #254356; text-decoration: underline !important">archived documentation</a></b> for Docker ' + dockerVersion + '. Go to the <a style="color: #254356; text-decoration: underline !important" href="https://docs.docker.com/">latest docs</a> or a different version: </span>' +
|
||||
'<span style="z-index: 1001" class="dropdown">';
|
||||
var listStart = '<ul class="dropdown-menu" role="menu" aria-labelledby="archive-menu">';
|
||||
var listEnd = '</ul>';
|
||||
@@ -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!");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user