Billeskov Posted February 10 Share Posted February 10 Hello, I have installed Fixed Header by Mypresta.eu. But when I scroll, some of the content disappears. What code should i change? I need my logo, seachbar and menu bar to be fixed. URL: www.billeskov.nu Link to comment Share on other sites More sharing options...
Ewonta Posted February 11 Share Posted February 11 Hello, if possible, send a screenshot so that it would be clear what you are talking about. Link to comment Share on other sites More sharing options...
Billeskov Posted February 11 Author Share Posted February 11 See video. I want fixed logo with seach and menu. Skærmoptagelse 2025-02-11 075900.mp4 Link to comment Share on other sites More sharing options...
Ewonta Posted February 11 Share Posted February 11 There are no such problems in the chrome browser, which browser do you have? Link to comment Share on other sites More sharing options...
Billeskov Posted February 11 Author Share Posted February 11 I use Chrome. Can you se the banner missing some content when i scrool. Is the samme on mobilephone. You can see it on the video, when it switch from fixed to non fixed. Link to comment Share on other sites More sharing options...
Ewonta Posted February 11 Share Posted February 11 To ensure your header stays fixed without issues and doesn’t shift the layout upward, you need to add a margin equal to the height of the fixed header. For example, if you pay attention to the class added during scrolling, omg_im_fixed, it indicates that the header has been fixed. In this case, we add a layout offset equal to the height of the header. .omg_im_fixed main { margin-top: 379px; } In this scenario, the layout won’t jump unexpectedly. However, it’s better to calculate the header height using a JavaScript script and automatically set the offset distance for the layout. This is a concept and requires further refinement. Link to comment Share on other sites More sharing options...
Billeskov Posted February 11 Author Share Posted February 11 I have change: Fixedheader.css @media (min-width: 576px){ .omg_im_fixed .modal-dialog { margin-top:379px!important; } } But it not work. "However, it’s better to calculate the header height using a JavaScript script and automatically set the offset distance for the layout." Have you a eksmpel on that? I have this javascript rigt now. $(document).ready(function () { $(window).scroll(function () { if ($(this).scrollTop() > 100) { $('#header').addClass("header_omg_im_scrolled"); $('body').addClass("omg_im_fixed"); } else { $('#header').removeClass("header_omg_im_scrolled"); $('body').removeClass("omg_im_fixed"); } }); }); Link to comment Share on other sites More sharing options...
Ewonta Posted February 12 Share Posted February 12 var headerHeight = $('#header').outerHeight(); $(window).scroll(function () { if ($(this).scrollTop() > 100) { $('#header').addClass("header_omg_im_scrolled"); $('body').addClass("omg_im_fixed"); $('main').css('padding-top', headerHeight + 'px'); } else { $('#header').removeClass("header_omg_im_scrolled"); $('body').removeClass("omg_im_fixed"); $('main').css('padding-top', '0'); } }); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now