- This topic has 11 replies, 3 voices, and was last updated 4 years, 5 months ago by
David.
-
AuthorPosts
-
April 12, 2021 at 10:53 am #1731577
Matt
To follow on from this thread, I tried adding the CSS supplied and it didn’t work – as in, the left sidebar didn’t appear at the top when viewed in a mobile browser.
April 12, 2021 at 11:37 am #1731649Ying
StaffCustomer SupportHi Matt,
Are you trying to move the left sidebar to top on mobile?
https://www.screencast.com/t/gL0wuwT0hjnIf so, you’ll need to add this css before the
}
of the mobile media query@media (max-width: 1024px)
:.site-content { display: flex; flex-direction: column; }
Let me know 🙂
April 13, 2021 at 12:37 am #1732093Matt
Thanks! That puts the nav menu at the very top on mobile (I’d prefer under the breadcrumb). That css also makes it look weird on tablet view
April 13, 2021 at 2:03 am #1732168David
StaffCustomer SupportHi there,
its not possible to move the sidebar between elements in the post content without using Javascript which i don’t recommend.
Instead you would need to add the ToC to the top of the Post Content ( which is where it will be left for tablet and mobile views ). Keep the now empty left sidebar.
If you want to set that up and let me know – i can then provide some CSS to position it where it currently is for desktop.
April 13, 2021 at 3:14 am #1732241Matt
Ah I see so you’d use css to move to left sidebar on Desktop only? Smart!
Yes please, I’ve moved TOC, custom css to place TOC in left sidebar on Desktop would be great, and much appreciated!April 13, 2021 at 4:06 am #1732294David
StaffCustomer SupportAny reason – why you’re using the Customizer > General –> Structure >> Floats option. It would be better all round to use the Flexbox version. If thats breaking stuff let me know. If it isn’t can you change to Flex ?
April 13, 2021 at 4:15 am #1732302Matt
I dont think so. I’ve just changed to Flexbox
April 13, 2021 at 4:45 am #1732333David
StaffCustomer SupportTry adding this CSS:
/* Position TOC over sidebar on wider screens */ @media(min-width: 1024px) { #primary { position: static; } #content { position: relative; } .lwptoc { position: absolute; left: 0; top: 0; height: 100%; padding: 20px; box-sizing: border-box; max-width: 220px; /* added this line */ } .lwptoc_i { position: -webkit-sticky; position: sticky; top: 0; } } /* remove sidebar on tabet and small devices */ @media(max-width: 1023px) { .left-sidebar #primary { flex: 1 0 100%; } .left-sidebar #primary .site-main { margin-left: 0; } #left-sidebar { display: none; } }
April 13, 2021 at 5:03 am #1732360Matt
Wow. That’s great! Thanks – Only the sidebar / TOC (when expanded/revealed) is overlapping the main content now?
April 13, 2021 at 5:27 am #1732382David
StaffCustomer SupportMade a tweak to the code above – i commented the line i added:
max-width: 220px; /* added this line */
may need to tweak the max-width value.
April 13, 2021 at 5:32 am #1732387Matt
That worked a treat! Increased max-width and decreased padding a bit. Thanks!
April 13, 2021 at 5:35 am #1732394David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.