How to have a fixed header in Suffusion Theme

Feb 272013
 
 Posted by on 27/02/2013 How-To's Tagged with: , ,  Add comments

If you wish to fix only the Navigation Bar Below Header and change the header AFTER the user scroll down the page, check also this post: https://drafie-design.nl/change-header-as-scrolling-the-page/. I changed the header of this site as is instructed in that post.

It’s not  a secret that I am a big fan of Suffusion theme written by Sayontan Sinha. My appreciation come from experience. I tested a lot of themes before discovering Suffusion – but it’s versatility and various features convinced me and I remain stick with this theme. Can make how many sites I wish and 2 sites will not look the same.  Actually I found only one feature which I can’t implement in Suffusion… but maybe my approach was wrong.

Now, coming to the subject. More than once on the Support Forum was asked a question about how making the header and  the navigation bar fixed, to not scroll when the site scrolling.

You know, for fixing an element it is enough to add a simple CSS declaration of  “position:fixed;z-index:1000;” – (the first property fix the element, the second bring the element on the top of page).  But this will align the elements on position (0;0) – on the top left corner-  for sure this isn’t the desired effect.

Fixed Header in Suffusion

Fortunately the mark-up of Suffusion permit to fix and align elements with few simple custom styles. All header elements are contained in a div with id #header-container, navigation bar is contained in #nav div. So, we can fix these containers and we will fix all elements inside them (header, description, menu items).

The code:

Copy the code and paste it at Suffusion Options -> Back-end -> Custom Includes -> Custom Styles. Adjust the values to fit with your design. Done, your header will stay fixed while the site will scroll below it.

Notes:

1. I settled the header and the navigation bar outside the wrapper, with background to fill the browser window but content aligned with the wrapper (Suffusion Options -> Other Graphical Elements -> Header and Navigation Bar Below Header). If you wish to have the header in wrapper you will have to adjust only the width of #nav to somewhere at 88 – 89%, or to the fixed value used for wrapper.

2. You can fix also the navigation bar above header (and if you wish to fix only the menu while the header will scroll with the content, the navigation bar above header is the solution) by using:

With a small javascript added at Suffusion Options -> Back-end -> Custom Includes -> Custom Header Javascript can set the position of navigation menu function of wp admin bar – for those who’s are logged in, the bar will be fixed below wp-admin bar (if is used in frontend). For the visitors, the bar will be fixed on the top of browser window:

 

You will have to move down either the header (if your header is outside the wrapper) either the wrapper (if the header is contained in wrapper). Or can fix the header as in first example, but below the top navigation bar. You need just small adjustments for “top” and “margin-top” properties.

https://drafie-design.nl/how-to-have-a-fixed-header-in-suffusion-theme/trackback/Trackback URI:  

Ciprian

Experienced web developer and graphic designer. Former consultant for Suffusion theme and former moderator on Suffusion Support forum. I teach others while learning myself.

Google+ Profile

    Google+ Page

 Leave a Reply

(Your comment will be published. To contact me privately, use the contact form.)

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  10 Responses to “How to have a fixed header in Suffusion Theme”

Comments (9) Pingbacks (1)
  1. Thank you! That may just do the trick 🙂

     
  2. With transparent headers not works. In the code exist a comment “/* we need a solid color otherwise will see the content scrolling below the header */”. Something transparent cannot hide the objects behind – this mean transparent, no?
    Maybe is worth to check my other solution for header: http://www.drafie-design.nl/change-header-as-scrolling-the-page/ (the transparent header will be visible when the visitor arrive to the page, but after scrolling down to read, only the navigation bar will stay fixed).

     
  3. How does this work with transparent headers? I’m hoping for something like this, but without being able to see the page through the transparent portions of the header

     
  4. Hy Pawan,

    Sorry for the little delay. I was very busy at my daily job.
    But I hope it was worth the wait, please check this post: http://www.drafie-design.nl/change-header-as-scrolling-the-page/

    Thank you

     
  5. I have tried the code for #nav. It fixed the navigation bar below header where it is. But what I want is that when page is scrolled up, only the ‘navigation bar below header’ scrolled up to the top (where top navigation bar is placed) and then fixed.

     
  6. Yes, you can, the code is already in the article. The CSS id for Navigation Bar Below Header is #nav.

     
  7. I want to fix only navigation menu below header. Is it possible in suffusion them?

     
  8. Yes, you also use Suffusion Theme 🙂

     
  9. your blog and my blog the style is similar.Beyond language.
    sorry,my english is poor.