About Sridhar Katakam
I am an independent WordPress web consultant with 10 years of experience in WordPress theme installation, customization, administration, maintenance, support, documentation, troubleshooting and PSD/design to WP.
Genesis and WordPress Tutorials
Session expired
Please log in again. The login page will open in a new tab. After logging in you can close it and return to this page.
The header is not sticky, it’s just fixed.
Can you show me an example of a sticky header?
Then try this plugin http://wordpress.org/plugins/genesis-sticky-menu/
Dear iniyan,
Please can you tell me how this plugins works? coz after activating it nothing change seemed on my site.
Brilliant π Thank you
Dear sir..
After adding the code to child themeβs functions.php as you described in step-2, i have got following problem “Parse error: syntax error, unexpected $end in /home/a7768091/public_html/wp-content/themes/eleven40/functions.php on line 79
Please solve to get fixed header.
Thank you.
Paste the code present in your theme’s functions.php at http://www.pastebin.com and give us a link.
Hi Sridhar sir,
This is my site http://www.nepaligajalsansar.com where i have my custom menu page list at the top. I want to fix/sticky that. As you I have tired it but faced some problem so i restore my css and function.php. Sir now i have pasted my css and function.php on pastebin please edit them and make my custom menu navigation fixed.
style.css http://pastebin.com/7GLmMm7V
fuction.php http://pastebin.com/zaJwg8fj
1) Change http://pastebin.com/raw.php?i=k4nkF3Bp to http://pastebin.com/raw.php?i=wi2EJ0Ng
2) Change top padding for body to 70px.
3) Add this: http://pastebin.com/raw.php?i=gzTnN0xR
No PHP changes are necessary.
Waau…..
Thanks a lot Sridhar Sir, I love your Job,please keep it up.
Sir please have a look once http://nepaligajalsansar.com its done as i wanted but why there still a header is appearing below this sticky menu? and why admin bar/logged in user bar is hiding my menu?
Sir I hope you got me,please help for the last. π
here is my latest CSS http://pastebin.com/AcnwUv8E
Thanks in advance
Add
#wrap {
background: transparent;
}
.admin-bar #header {
top: 28px;
}
Sridhar… I love you! π thanks for this!!! I’ll subscribe your blog!
There’s a free WordPress plugin called Sticky Header http://wordpress.org/plugins/sticky-header/ if you don’t want to mess up with editing CSS.
Any feedback is quite welcome.
Thank you! That worked perfectly! Fantastic how-to, very simple even for newbies π
Hi! Thanks for this. How would I make BOTH the primary and secondary stick? If I make the secondary stick using your code for the Agency Pro theme, the primary menu becomes unstuck. Thanks.
I managed to make multiple elements sticky by duplicating the code between:
jQuery(document).ready(function($) {
and
});
Then in the second chunk of code I changed all the $filter and $filterSpacer variables to something else, in my case I used $efilter and $efilterSpacer wherever they occurred.
And of course the name of the class to be affected: .nav-primary
I don’t know if that’s the “proper” way to do it, but it worked.
Sridhar, you are the man! This is exactly what I wanted for my site and you made it happen for me in a matter of 5 minutes. Thank you!
How would I change the point at which it “kicks-in”? I would like the menu to start sticking at a point below the top of the screen.
Currently my sticky bottom nav disappears under my sticky top nav, then re-appears as it hits the top of the screen.
This is not the same as changing the offset in the .fix and .admin-bar .fix though the value would be same as the .fix value, and would need to be included in the sticky-nav.js code. But where?
Hello. I’m trying to implement this on the secondary menu here. http://www.rebeccakelsey.dreamhosters.com, however, it doesn’t appear to be sticky.
I created a folder called js right under the theme (blissful) and put the js code in a file in there. I also added the php and css.
Can you see what I’ve missed?
So, the theme I’m using isn’t HTML5….any ideas how to fix it or get it working?
Here you go: http://www.sridharkatakam.com/sticky-secondary-menu-blissful/
[…] one of my earlier posts titled How to set up Sticky Header or Navigation in Genesis, a user asked in the comments as to how to tweak the code to make the secondary navigation menu […]
Sridhar,
Very nice – thank you!
I tried the Genesis Sticky Menu plugin, but getting all the CSS right was a pain. I did not have to touch the primary menu CSS with this method. I also use the Dynamik theme and was able to paste the code nice into the appropriate custom slots – no direct editing of functions.php, etc.
One question. When I scroll up, my menu shifts just a bit to the right and down. Any ideas where to look for this little annoyance?
If you have any chance to look, the test site for just the menu (i.e. no real content) is here:
http://expo.ingersollinteractive.com/
Thanks for any help you (or anyone else) can share.
– Peter
I took a brief look and this indeed looks puzzling. I have not been able to figure out a fix for this.
Thanks for looking. When the sticky kicks in (nav class changes to “nav-primary fix”) the wrapper width is reduced by a few pixels (depending on the overall width, I think). That’s just the results I’m seeing – I’m not expert enough to see why.
I imagine since the CSS you have includes “width: 100%; max-width: 100%;” something must be happening with that area.
Got it.
Add this CSS:
.nav-primary {
-moz-box-sizing: border-box;
box-sizing: border-box;
}
Your above comment gave me the clue.
Yes – that’s done it!
Thank you for your generous attention!
Thanks – everything worked like a dream. The tutorial was very easy to understand. Super….
Sridhar, I wanted to ask if you ever update this post, could you include something about using jQuery to hide the menu when inactive for 10 seconds or so. I noticed Mailchimp use a Sticky header but also have a nice touch by allowing the menu to disappear when viewers are not scrolling. http://blog.mailchimp.com/ – I tried working out how they did it but I don’t have that much experience as a developer. Anyway – thanks again.
See if this helps: http://www.sridharkatakam.com/set-fixed-nav-menu-appears-upon-scrolling-news-pro/
I added this code to my site running metric theme and nothing happens – sticky secondary menu
Fantastic Tutorial…..works really well, thank you
You may like http://www.sridharkatakam.com/using-jquery-pin-make-element-sticky-wordpress/ even better.
No words to thank you Sridhar sir,
Great Job.
Thank you very much from my humble heart.
I bookmarked and subscribed you. π
You are super! Thank you!
I have a question though, it works great (I followed the make Primary menu Sticky), except it makes like a quick ‘jump’ motion when it goes to ‘stay sticky’ can you see what I mean? Is there any way to smooth this out? THANK YOU!
I’m working with the Minimum Pro theme!
The site is a test site and it’s: http://amystout.com/wordpress1/
Follow http://www.sridharkatakam.com/make-header-primary-nav-fixed-minimum-pro/
Oh I’m confused now do I undo what I just did for this post? Also I have already also completed the part on your blog for moving the Primary menu to below the header…will any of this change what you are telling me to do now?
THANK YOU! So 2 questions now:
1. Do I undo what I just did
2. Does it matter that I followed your other post on moving the Primary menu in Minimum Pro?
1. Yes.
2. I do not remember the method I posted in my other post you are referring to. So just undo any changes you’ve done when you followed that as well.
3. Just follow the new one linked above.
I’ve done all the steps listed above to add the sticky primary navigation menu, and yet it still does nothing. I’m using Genesis with the Adorable theme. I’m not sure what to do from here? Help please! π
Replace “.nav-primary” with “#nav” in steps 1 and 3.
Hi! Thanks for a great tutorial. I’m just wondering if anyone else has this problem or if anyone know a solution. In safari the text switches from bold to regular font when I scroll down and I can not see any reason why. I have switched of my custom fonts but that did not resolve the problem.
Can you provide the URL of your site?
Hi Sridhar,
Hope you are doing well.
I have been following your blog for quite a while. First met you at Ibuilder forum.
Thanks for all the tuts, thanks a lot.
Well, i was trying to use this tutorial to get my ubermenu sticky, by changing the CSS selectors.
it went nicely, till i activated the w3tc total cache minify option and the page speed service.
After activating them, the nav menu failed to stick.
After trying several options i finally enqueued the ‘ stickUp
‘ jquery plugin and added a javascript.
I have tried at least 5 jquery sticky plugins including stiockler.js.
It seems ‘ stickUp
it is the only one compatible with w3tc minify option and page speed service.
once again thanks a lot, for helping me get started.
thanks and regards
Hi Sridhar,
do you have any idea, how this can be disabled with smaller viewports? It works fine on desktop view – I sticked the sidebar on right side. But if it goes to responsive, the sidebar sticks further and overlays the content. Any help would be very appreciated. Just while writing, I had an idea. I did not test to set the z-index back to 0 on smaller viewports. Probably this could work. Do you have a better idea?
Have you checked Addendum section at the bottom of the post?
[…] like header and navigation can be made to stick to top of page when the user scrolls past using jQuery script and […]
Question. I just want the fixed header and I will not have a primary or secondary menu. When I remove the primary/secondary menus the site inner goes way up under the header area. Any ideas on how to make the header fixed and not have the text go all up under it? Click my name for site demo. π
I found it here : http://youneedfat.com/fixed-header-wordpress/
You’re a Genesis legend! I love your articles! The only difference is that with the Dynamik child theme, I had to add a /lib/ to get to my js directory. But the sticky menu is PERFECT! Thanks!
I tried to apply this to my new enterprise pro theme that I have the nav and social icons in the header. Is this still possible? Your tuts are great and am wondering if this is able. Thanks for any help you can provide.
What a nice article!You are such an amazing coder man!The only question I have is if a horizontal line of 1 px thickness above the fixed menu when it is at the top of the page is normal.You can check it at vga-frankfurt.de
I added this to my genesis balance theme website and nothing happened. Any tips?
Are you trying to set up a fixed header or Primary Nav or Secondary Nav?
It works beautifully! I have just tried the header for now. Will experiment with Primary and Secondary Nav soon. I never tire thanking you Sridhar! Phenomenal contribution to this community. Keep it up!
Sridhar-
I think I followed the directions correctly for making the Primary navigation menu fixed. Can you check my site and see if I have done something incorrectly?
Thanks,
Sasha
Hi. Firstly a most wonderful tutorial that got my menu nice and sticky within a short amount of time so thank you very much.
I have however encountered a problem. In chrome the sticky menu works perfectly, however it does not run properly in firefox for some reason. Is there any chance you could take a look and see if you can see what might be going wrong?
http://www.uktransactionalanalysis.co.uk
Many thanks to anybody that might be able to help.
Dena
Hello! I am using the Runway theme and I followed your instructions for the primary navigation and it doesn’t appear to be sticking. I’ve used these instructions before on a different site and it worked flawlessly so I’m not sure what’s happening here. My test site is here: http://mystylevita.southernblogsociety.com/
Thank you for your help and your incredible tutorials!!
Whitney
Thank you so much, works a treat!
Just sent you a thank you donation, really appreciate how often your articles help me out!
Another great tutorial. Thanks for posting this one. I’ve combined this with the sidr menu tutorial, they work great. I did also try the jquery-pin but seemed to have a problem with the menu width when resizing from small to large. Unless it only happens when resizing a browser window, idk.
I was wondering if I could sticky the font awesome hamburger also with this by adding something here: var $filter = $(‘.nav-primary’);
Even if it wouldn’t work, jquery pin probably would but do most people disable the sticky on tablets or menus?
Hi Sridhar,
I have tried to make the header sticky – I have made it. Also with a menu that is not widget.
Now my problem is that on mobile devices, the header covers whole screen of the phone and pages text can not be seen anymore,
Hve you any idea on how to make the header NOT to be sticky on mobile devices – or how to make it less height ?
The website is: http://www.masuratori-cadastru.ro
( language is romanian – Romania)
Thank you !
Thanks for the great tutorial.
I followed the tutorials for primary nav, but everything shifts to the left. I want it to be centered.
Any clue what i am doing wrong.
Theme – Executive Pro
Thanks
Hi Sridhar,
I followed your instructions and it works flawlessly!!!
But now I have a simple GIF animation that emphasises the sticky header (I also changed the height of the main navigation). The fact is, that the animation only plays one time: the first time I scroll down. Every other page I visit shows the GIF-animation but ‘freezed’ at the last frame of the animation.
I want the animation play every time (once) on every page when I scroll the page.
How can I do that?
In other words (maybe off-topic), how can I replay the GIF animation on every other page of the website?
p.s.: Unfortunately I cannot give you a URL, because what I’m working on is on a local server.
Thanks so much Sridhar. I was hesitant to try this on a site that I use the Dynamik theme, but it was so easy to do. I just had to put the code in the custom js and functions and play around with the CSS a little bit. Probably took less than two minutes and now I have sticky navigation. Thank you!
I am trying to do the exact opposite, get rid of the sticky navigation that comes with the Magazine Pro child them on top of Genesis. I should be able to edit the style.css file to do this, but I can’t figure out what to edit. The forums have been of no help on this, thanks.
I’ve turned this into a plugin with additional offset feature:
http://simonbarnett.co.za/downloads/genesis-sticky-nav.zip
In Settings -> Genesis Sticky Nav you can set:
.nav-primary or .nav-secondary
Active when window is wider than:
Offset from the top
There’s a demo here: http://simonbarnett.co.za/tests/sample-page/
In addition to Genesis Sticky Nav, the demo also has:
A standard fixed .nav-primary
A sticky widget area based on a modified version of the Sticky Element plugin (from WordPress repository).
The modified Sticky Element plugin – “Sticky Element with Offset” – allows for an offset to handle all the sticky/fixed going on. Sticky Element with Offset is available here: http://simonbarnett.co.za/downloads/sticky-element-with-offset.zip
You are such a rockstar! I just did this literally in about 2 minutes. Keep it coming Sridhar!
Sridhar,
Great tutorial; implemented it in just a few minutes. I have two things, one fix for an above user and one question.
1) A user above mentioned that they had “bold issue in Safari.” I’ve seen this before and correct it by adding the following CSS:
-webkit-font-smoothing: antialiased; -moz-font-smoothing: antialiased; -ms-font-smoothing: antialiased;
2) I am using this in Beautiful Pro and have a scrolling issue where the menu “jumps” on the transition. As with the above “bold glitch” it seems to be on Safari, but not on Chrome or Firefox. Any suggestions? My site is here.
Thanks!
Worked like a charm for primary nav using Genesis Outreach Pro.
Thanks : )
I’m getting my money’s worth this month! Another excellent tutorial. Thanks, Sridhar.