nick
nick

Reputation: 1246

smint jquery refresh page and nav stays where you were insted of reseting.

Im using smint jquery sticky nav, here is link to home page here. I noticed that if you scroll down a little and refresh the page, the nav loads where you refreshed the page instead of back at the top, take a look and try it, maybe someone has a solution. I found a few people asking the same question but with know answers yet. Thanks for your time.

Upvotes: 0

Views: 337

Answers (2)

nick
nick

Reputation: 1246

at the bottom of the jquery.smint file before the last

  })();

add

  $(document).ready(function() {
      $(window).scrollTop(0);
      stickyTop = 0;
  });

Upvotes: 1

Travesty3
Travesty3

Reputation: 14479

I know nothing about "smint", but using jQuery, you could set the scroll position of the page to the top when the page loads, like this:

jsFiddle

$(document).ready(function() {
    $(window).scrollTop(0);
});

What this should do is, wait for the page to load, and then set the scroll position to the top of the window.

If this doesn't happen to work because the browser sets the scroll position after your jQuery executes or something, you could try setting the scroll position to the top before refreshing the page, that way when it refreshes and goes to the previous scroll position, that will be the top of the page anyways.

Upvotes: 1

Related Questions