Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sidebar in the middle of page on pageload #16

Closed
Globegitter opened this issue Aug 24, 2014 · 8 comments
Closed

Sidebar in the middle of page on pageload #16

Globegitter opened this issue Aug 24, 2014 · 8 comments

Comments

@Globegitter
Copy link
Contributor

If my page is scrolled down and I refresh the page, the navbar is something just randomly in the middle of the page.
capture d ecran 2014-08-24 a 23 10 30
Here you can see the signup button, etc in the middle of the page.

@jbutko
Copy link
Owner

jbutko commented Aug 25, 2014

StickyNavbar script remembers the position of window that was before refresh.
If I understand well the problem are those buttons above the navigation on the right side (Share, Follow us etc.) If that's the case try to remove those elements out of the element on which StickyNavbar is called (header). If you have a development site please leave the link here in the comment or email me on jbutko [at] gmail.com and I will take a look on it.

@Globegitter
Copy link
Contributor Author

@jbutko Thank you very much, just sent you an email.

@jbutko jbutko closed this as completed Sep 11, 2014
@kaibakker
Copy link

I am having the same problem, and its still unclear how to fix it. Its live on the following (dutch) website: http://www.examentrainingexact.nl/examentraining/1-vwo-wiskunde-a

@jbutko
Copy link
Owner

jbutko commented Dec 5, 2014

@kaibakker: Hi, try to reference version 1.1.3 of stickyNavbar in the script tag instead of 1.1.1 http://cdn.jsdelivr.net/stickynavbar.js/1.1.3/jquery.stickyNavbar.min.js
Let me know if that helped.

@kaibakker
Copy link

Thanks @jbutko for looking at it. But its still not working? I tried some different things and changed the version number, but still the bar is hanging on reload, any other ideas?
Thanks in advance

@jbutko
Copy link
Owner

jbutko commented Jan 4, 2015

@kaibakker: Hi, really not sure why this happened on your site, it looks like it is working fine on my demo page. Anyway you can probably fix it with this workaround (I do not tested it properly but it should work IMO):

var leftColVertPosition = $('.l-left').offset().top,
    windowVerticalPos = $(window).scrollTop(),
    menuBar = $('#menubar');

if (windowVerticalPos > leftColVertPosition) {
  menuBar.style.top = "0";
}

Try it, adapt it if needed and let me know.

@jbutko jbutko reopened this Jan 4, 2015
@kaibakker
Copy link

Thank you! Works perfectly, eventual used this script...

$(document).ready(function () {
  $('#menubar').stickyNavbar();

  var leftColVertPosition = $('.l-left').offset().top,
    windowVerticalPos = $(window).scrollTop(),
    menuBar = $('#menubar');

  if (windowVerticalPos > leftColVertPosition) {
    menuBar.css({top: "0"});
  }
});

@jbutko
Copy link
Owner

jbutko commented Jan 5, 2015

No problem Kai, glad I could help.

@jbutko jbutko closed this as completed Jan 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants