Site logo

Archived topic

Sticky LEFT sidebar....

3 replies · Started by Tim on June 15, 2019

Viewing posts 1–4 of 4

Some weirdness here.
I simply want a stocky left sidebar on a page that has a header, menu, left sidebar with content area, and a footer.

I have seen the code - here -for a RIGHT sticky sidebar VIZ

@media (min-width: 769px) {
   #right-sidebar {
		
        position: -webkit-sticky;
        position: sticky;
        top: 0;	 		
    }
}

and thought - optimistically that changing #right-sidebar to #left-sidebar would work...
Sadly not! I DO end up with the left sidebar sticky ... on the right side!

For avoidance of doubt, this is what I have in the css:

@media (min-width: 769px) {
   #left-sidebar {
		
        position: -webkit-sticky;
        position: sticky;
        top: 0;
		 	 
		 		
    }
} 

The site is a test site with GP pro, all modules except woo active and only the gp and simple css plug in... The left sidebar has a single text widget in it.
I have NO idea what's going on. The problem is consistent across a live site (so I am not using it there).

Help?

NB I tried adding a

left: 0;

But that had no effect at all..

PPS I KNOW I can use a plug in to achieve this - and I have on a live site but - really - can't see why I can't do it with simple CSS.... :(

Hi there,

the plugin is the simplest option. The issue with using CSS is that the Sidebar is positioned using floats and the unsemantic grid. Using the Position sticky stops the float from working and it falls back to its natural position. Adjusting its horizontal position with position sticky is a right pain.

Thanks David,
thought it might be too easy ;)

I'm using the WP Sticky Sidebar plug-in and using the #left-sidebar selector which seems to do the trick.

Appreciate the response on the weekend!
Cheers

You're welcome :)

This archived topic is closed to new replies.