Closed ArtinM closed 8 years ago
This is a possible repeat of https://github.com/kswedberg/jquery-smooth-scroll/issues/61 and you may also like to look at https://github.com/kswedberg/jquery-smooth-scroll/issues/68 first for an understanding of what's happening.
Thanks, @LL782!
Also, @ArtinM, I added an example here: https://github.com/kswedberg/jquery-smooth-scroll#smooth-scrolling-on-page-load
If you want to delay the smooth scrolling, you can put the code "for page-2.html" inside a setTimeout(fn, delay)
or even just inside a $(window).on('load', fn)
callback. (Using a function instead of fn
and number of milliseconds instead of delay
)
Thanks @kswedberg. The example code is great. I think I'll use that in place of my previous suggestion.
Excellent! Glad I could help.
Hi,
I'm using the following code and it works really great on anchors on the same page. It also somewhat works when the anchor is on another page (e.g. page2.html#anchor), but it happens too quickly when it scrolls on different pages. Is it possible to make it when it loads another page with an anchor it waits a second or waits for page to fully load before it scrolls down to the anchor? I don't want this to affect and delay anchors on the same page, only when you're going to an anchor on a different page.
Thank you.
Current code:
jQuery('body').smoothScroll({ delegateSelector: 'a', offset: -60, speed: 1000, });