Jump to content

BRINE Template Stick Nav with Black on scrolling

Recommended Posts

Hi Everyone,

I've created a client site using Brine and set the navigation to float on the header image. But, I really need to have a sticky header so that when scrolling, the nav section switches to a black background.

I used some code which does make the nav sticky, but this does not switch the navigation block, so, the links are currently not viewable when scrolling over the rest of the page.

Header {
   position: fixed !important;
   top: 25px !important;
   left: 0 !important;
   right: 0 !important;
}

I want the header to be sticky on all pages.

I hope there is an easy fix for this?

Many thanks in advance.

Link to comment
  • Replies 4
  • Created
  • Last Reply

In this case, you need to use JavaScript.

With JS, you can add a CSS Class to Nav on scroll, then use background color & position fixed for that class. 

Difficult to help without site url.

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment

You may try the solution suggested here, but also consider that's not most performant way to go about it. See my response at the end of that thread, if you're interested.

Another option is to use Fixit - Fixed Headers for Squarespace - Brine which I created.

Besides helping with making fixed/sticky headers (and accounting for a lot of variables that most CSS-only solution do not account for), it also adds the ability to add/remove a CSS class at the scroll-distance of your choice, making it fairly easy to adjust navigation color, background color, text size, opacity, logo size (or alternate logo), etc. when scrolled.

When simple CSS approaches work, use 'em. If they don't, you can checkout Fixit.

-Brandon

If a response helped you out, send a 'Like' 👍 (bottom-right) and/or 'Upvote' vote.jpg.c260784ece77aec852b0e3049c77a607.jpg (top-left)

Link to comment
On 1/3/2020 at 8:27 PM, brandon said:

You may try the solution suggested here, but also consider that's not most performant way to go about it. See my response at the end of that thread, if you're interested.

Another option is to use Fixit - Fixed Headers for Squarespace - Brine which I created.

Besides helping with making fixed/sticky headers (and accounting for a lot of variables that most CSS-only solution do not account for), it also adds the ability to add/remove a CSS class at the scroll-distance of your choice, making it fairly easy to adjust navigation color, background color, text size, opacity, logo size (or alternate logo), etc. when scrolled.

When simple CSS approaches work, use 'em. If they don't, you can checkout Fixit.

-Brandon

Thanks for this and It's a definite for me to buy now :0).

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.