Tagged: x
-
AuthorPosts
-
July 29, 2016 at 7:18 pm #1109557
Hi there,
Ah, looks like working, just need to change this
function x_scroll_to($, scroll_to) { if( scroll_to.length > 0 ) $('html,body').animate({scrollTop: $(scroll_to).offset().top - $('header.masthead').height() },700 ,'swing'); }
to this
function x_scroll_to($, scroll_to) { if( scroll_to.length > 0 ) $('html,body').stop().animate({scrollTop: $(scroll_to).offset().top - $('header.masthead').height() },700 ,'swing'); }
Your page has multiple scroll animation. Added stop() to halt other animations.
Please try that and let me know 🙂
The whole footer wraps within the link because of not properly closed
<p>
and<a>
. Glad it’s fixed now.Thanks!
July 29, 2016 at 7:38 pm #1109570Tried that and it still seems to jump to the section and then scrolls down really fast.
Thanks!
July 29, 2016 at 11:30 pm #1109823Hi there,
It’s not jumping on my end, and it’s normal for it to scroll fast when the target position is too far.
Also, the scroll happens while the page is loading, it’s different from clicking a button then scroll. Hence, it will scroll while it loads.
You can try this one,
jQuery(function($){ $('html,body').stop().scrollTop(0); $(document).ready(function() { var hash = location.href.split("#").slice(-1)[0]; var outbound = /^https?:\/\//i; if( hash && !outbound.test( hash ) ) x_scroll_to($, $('#' + hash ) ); }); $('.scroll_to').click(function(e){ e.preventDefault(); x_scroll_to($, $('#' + $(this).attr('href').split("#").slice(-1)[0] )); }); }); function x_scroll_to($, scroll_to) { if( scroll_to.length > 0 ) $('html,body').stop().animate({scrollTop: $(scroll_to).offset().top - $('header.masthead').height() },700 ,'swing'); }
This line
$('html,body').stop().scrollTop(0);
force it to originate on top then scroll.Thanks!
July 30, 2016 at 12:36 am #1109855Alright thanks. Not sure why it still jumps to the section, goes back to the top and then scrolls down for me.
But I guess if it doesn’t do that for you then it’s fine. I just would like to see it work.
I don’t actually mind that it scrolls while the page is loading. My issue is the glitchy effect where it jumps then scrolls.
July 30, 2016 at 1:02 am #1109871Hi there,
Yes, looks okay from my end. Though yes, sometimes it jumps a little depending on loading speed on my end.
Thanks!
-
AuthorPosts