Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Fixed Navigation on Internet Explorer Covering Page


abcohen1605

Question

  • Answers 1
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

Popular Posts

Add the following JS below. This adds padding to the body equal to the height of the header to push the content down: (function (document, window) { if(document.readyState !== 'complete') {

Posted Images

1 answer to this question

Recommended Posts

  • 0

Add the following JS below. This adds padding to the body equal to the height of the header to push the content down:

(function (document, window) {

  if(document.readyState !== 'complete') {
    window.addEventListener('DOMContentLoaded', function(event){
      init();
    });
  } else {
    init();
  }
  
  function init(){
    var isIE10 = navigator.appVersion.indexOf('MSIE 10') !== -1;
    var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;

    // Exit if we're not in an IE browser.
    if (!isIE11 || !isIE10) return;

    // Add padding to the body based on the height of the Header
    addPaddingToBody();

    // Re-calculate body padding when user resize browser
    window.addEventListener('resize', debounce(function () {
      addPaddingToBody();
    }, 200));
  }

  function addPaddingToBody() {
    var header = document.querySelector('Header');
    var headerHeight = header.offsetHeight;
    document.body.style.paddingTop = headerHeight + 'px';
  }

  function debounce(func) {
    var wait = arguments.length <= 1 || arguments[1] === undefined ? 100 : arguments[1];

    var timeout = void 0;
    return function () {
      var _this = this;

      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }

      clearTimeout(timeout);
      timeout = setTimeout(function () {
        func.apply(_this, args);
      }, wait);
    };
  }
})(document, window);

Make sure the JS code is between <script> tags, example:

<script>
  // Add JS code here
</script>

 

Edited by jpeter
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...