Git Product home page Git Product logo

Comments (4)

somewebmedia avatar somewebmedia commented on June 11, 2024 1

Ah I see, when the menu opens, if you have pushContent option enabled, the container element gets transform property which displaces any fixed child element.
Here is the explanation of why that's happening: https://stackoverflow.com/questions/15194313/transform3d-not-working-with-position-fixed-children/15256339#15256339

So a workaround would be something like this:

var $fixed_header = $('#fixed-header'); // your fixed header element
var $container = $('#container'); // element that you've set to pushContent

Nav.on('toggle', function(e, settings) {
  if (e.data.action == 'open') {
    $fixed_header.css('top', -$container.offset().top);
  }
});

Nav.on('close', function(e, settings) {
  $fixed_header.css('top', 0);
});

from hc-offcanvas-nav.

somewebmedia avatar somewebmedia commented on June 11, 2024

Can you provide me with some demo so I can check what's happening?

from hc-offcanvas-nav.

Phoenixy avatar Phoenixy commented on June 11, 2024

Hi,
I also saw this happening to me as well, but I think this is the expected behavior, so I have no problems with it.
If you open the menu on the top of the page (without any scrolling), the fixed header won't disappear, but if you scroll down, then open the menu there, the fixed header disappears.
example1
example2

from hc-offcanvas-nav.

Exacore avatar Exacore commented on June 11, 2024

You can try to fix this bug with thoses lines of code (jQuery) :

// Resize
function resize() {
// Sticky Fix
var headerHeight = $('.header').outerHeight();
$('.header').css('position', 'fixed');
$('.header').next().css('margin-top', headerHeight + 'px');
}
window.addEventListener('resize', resize);
resize();

from hc-offcanvas-nav.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.