Sha256: c94af660b98860442e238d6a3569914cf1388cac78ee423e3a77477d435b51df

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

/* Start of script:
Calculates the height of the navbar in relation to the AdocTitle tag
when a document is selected or in relation to the home tag when
the menu of a project is selected.
Additionally when the start page index is loaded it assigns a fixed
height value to the navbar instead.
*/

const nav = document.querySelector('nav');

function setupNavHeightCalculator(element) {
  return function() {
    const navHeight = nav.clientHeight;
    element.style.marginTop = navHeight + 20 + "px";
  }
}

const adocTitle = document.querySelector('#adocTitle');
const home = document.querySelector('.home');
const homeIndex = document.querySelector('.homeIndex');

if (adocTitle) {
  const calculateNavHeight = setupNavHeightCalculator(adocTitle)
  
  window.addEventListener('resize', calculateNavHeight);
  calculateNavHeight();
} else if (home) {
  const calculateNavHeight = setupNavHeightCalculator(home)
    
  window.addEventListener('resize', calculateNavHeight);
  calculateNavHeight();  
} else if (homeIndex) {
  nav.style.height = '60px';
}

if (window.navigator.userAgent.indexOf("MSIE ") > 0 || window.navigator.userAgent.indexOf("Trident") > 0) {
  const footer = document.querySelector('footer');
  footer.style.display = "none";
}
//End of script

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
docs-cambiocds-com-jekyll-theme-1.0.12 assets/js/custom.js
docs-cambiocds-com-jekyll-theme-1.0.11 assets/js/custom.js