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

Marta Template: How to centralise the header (primary navigation) and make it sticky at the top with solid background?


mshlltg

Question

Site URL: https://www.inoutatelier.com

Hi all,

Please see attached site url.

Previously I tried to to make the header sticky at the top but it always appear to at the back of all my content as I scrolled down. Also I would need it have a solid background for the header, and centralised too. Can anyone help with this? 

Many thanks. 

Link to post
  • Answers 8
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Popular Posts

Add to Home > Design > Custom CSS .Header-inner--bottom>div { flex-direction: column; }  

8 answers to this question

Recommended Posts

  • 0

Thank you! The centralise worked. 

I also need the header to be fixed at the top with background when I scroll down, appreciate if you can help on the code.

Thank you!

Link to post
  • 0

Add to Home > Settings > Advanced > Code Injection > Header

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
 $(window).on("scroll", function() {
        //Sticky Header start
   		header = $('header.Header.Header--bottom');
        if ($(window).scrollTop() > 30 ) {
            header.addClass("sticky");
        } else {
            header.removeClass("sticky");
        }
});
</script>
<style>
  .sticky {
  	position: fixed;
    z-index: 999;
    top: 0;
    left: 0;
    width: 100%;
    background: red;
  }
</style>

 

You can send your question to my email to get detail answer. / How to Setup Password & Share URL

--- Happy New Year

Link to post
  • 0

Hi Tuan,

I would like to make 1 section sticky at the top of one page only and with a transparent background (it's a narrow line of text acting as navigation anchor links).

I'm trying to customise the code you gave above, but not having much luck. I put it in Advanced injection code of that page only, right? Is anything required to go in Design/Advanced/CSS to make it transparent?

This is the section ID:

section[data-section-id="5f59e427074004756e44cdd8"]

Thanks so much in advance.

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...