Tagged: x
-
AuthorPosts
-
March 9, 2017 at 10:12 am #1400675
Hi, I want the topbar (I’m assuming is using the class .x-topbar) to be sticky with the navigation when the user scrolls down.
Please advise.
Thanks.
March 9, 2017 at 12:02 pm #1400798Hi there,
Thanks for wriitng in! It’s possible with some JS and CSS.
#1. You can add this under Custom > JavaScript in the Customizer.
jQuery( function($) { $(window).on("scroll", function () { if($('.x-navbar').hasClass('x-navbar-fixed-top')) { $('.x-topbar').addClass('x-topbar-fixed-top'); }else { $('.x-topbar').removeClass('x-topbar-fixed-top'); } }).scroll(); });
#2. Then add this under Custom > CSS in the Customizer.
.x-topbar.x-topbar-fixed-top { position: fixed; left: 0; right: 0; top: 0; } .x-navbar.x-navbar-fixed-top { top: 46px; }
Hope this helps.
March 9, 2017 at 2:24 pm #1400991Yep. That’s exactly what I was looking for. Thank you.
However, there is one minor issue where the nav and topbar both “skip” down a few pixels. Any idea how to fix that?
March 9, 2017 at 10:20 pm #1401483Hi There,
You’re welcome!
I did check your site and I didn’t see the code implemented so I cannot see the issue.March 18, 2017 at 9:31 am #1412128Sorry, I changed it. 🙂
But I’m changing is back now as we speak.
March 19, 2017 at 2:53 am #1412553Hello There,
Thanks for updating in! I have checked your site and please update your custom css. You can make use of this:
body .x-topbar.x-topbar-fixed-top { position: fixed; left: 0; right: 0; top: 0; } body.logged-in .x-navbar.x-navbar-fixed-top { top: 32px; }
We would loved to know if this has work for you. Thank you.
March 22, 2017 at 8:50 am #1416210Ya, it’s still doing the little skip thing.
It appears as though x-topbar is scrolling outside the viewport of the browser window, then jumping into its fixed position, thus causing the ‘skip’ to happen.
Perhaps it’s something in the custom js?
Thanks again for your help.
March 22, 2017 at 1:25 pm #1416586Hi there,
Please try to update this code:
.x-navbar-fixed-top { top: 0; left: 0; right: 0; }
to
.x-navbar-fixed-top { top: 46px; left: 0; right: 0; }
Hope this helps.
March 25, 2017 at 1:01 pm #1420178Nope. That doesn’t work either.
The x-top bar is scrolling past the viewport, then back into position. This is that is causing the “skip”.
Maybe reproduce the bug with the first solution given? Then finding a solution and posting it here.
Thanks.
March 26, 2017 at 1:51 am #1420463Hello There,
Did you disable the Topbar? May we ask some permission to enable it back or could you please enable it back?
Thank you in advance.
March 26, 2017 at 7:32 am #1420607I changed the site back for you. I need this working ASAP.
Thanks.
March 26, 2017 at 6:59 pm #1420954Hello There,
Thanks for putting it back. When I view your site, it looks this way:
Could you please send us a screenshot so that we will have an idea of how it looks like from your end?
And by the way, there is another thread which request to have a sticky topbar and it it has a different solution give. Maybe you can also check it out, apply it to your site and maybe compare to the current solution which is best. Read it more here: https://community.theme.co/forums/topic/sticky-topbar/#post-795687
Please let us know how it goes.
March 26, 2017 at 8:22 pm #1421065The problem is that the x-topbar doesn’t stop when it scrolls to the top of the page. The x-topbar scrolls past the viewport by about 10px then skips into place.
A screenshot won’t show this. You will have to navigate to the page and give it a try.
Thanks for looking at this.
March 26, 2017 at 8:24 pm #1421066Maybe the javascript can be applied to make the masthead sticky instead of the top bar?
March 27, 2017 at 1:02 am #1421220Hello There,
Thanks for updating in! I would suggest that you do the solution as suggested from the thread: https://community.theme.co/forums/topic/sticky-topbar/#post-795687
Because the solution their combines the menu and the topbar which is why there should be no skipping of the topbar area as soon as someone scroll on the page.
Please let us know how it goes.
-
AuthorPosts