I have a popup that is dynamically loading content and using overflow: auto
to maintain the popup size and in turn make it scrollable. I have a link at the bottom currently using anchors to scroll to the top of the div. Unfortunately it is also forcing the page to scroll down to that point as well as scroll to the top of that div.
I am trying to prevent the page from scrolling and only scroll to the top of the div. I have tried numerous scenarios of scroll to top:
$('#id').scrollTop(0);
as well as
$('#id').animate({
scrollTop: 0
}, 'slow');
Unfortunately this is doing nothing. I am not getting any errors. I have attempted to try it in a console and not attached to any click event and it does nothing and just prints the id to the console that I am targeting.
Here is the link to the actual production version of this page. If you click the link for privacy policy, terms or learn more and then hit any of the back to top links you will see what the issue is.
Here is the site
I have a popup that is dynamically loading content and using overflow: auto
to maintain the popup size and in turn make it scrollable. I have a link at the bottom currently using anchors to scroll to the top of the div. Unfortunately it is also forcing the page to scroll down to that point as well as scroll to the top of that div.
I am trying to prevent the page from scrolling and only scroll to the top of the div. I have tried numerous scenarios of scroll to top:
$('#id').scrollTop(0);
as well as
$('#id').animate({
scrollTop: 0
}, 'slow');
Unfortunately this is doing nothing. I am not getting any errors. I have attempted to try it in a console and not attached to any click event and it does nothing and just prints the id to the console that I am targeting.
Here is the link to the actual production version of this page. If you click the link for privacy policy, terms or learn more and then hit any of the back to top links you will see what the issue is.
Here is the site
Share Improve this question edited Mar 12, 2021 at 23:39 Amir 1,3583 gold badges15 silver badges29 bronze badges asked Dec 18, 2013 at 15:38 user2112618user2112618 3466 silver badges21 bronze badges 3- Can you please explain a little better what are you trying to do? Site and functionality looks good to me. – Babblo Commented Dec 18, 2013 at 15:42
-
Your production site is at a
vw.
sub-domain? – Jasper Commented Dec 18, 2013 at 15:43 - BTW, if I fix the problem I don't want the points, just a VW Phaeton :) – Babblo Commented Dec 18, 2013 at 15:47
1 Answer
Reset to default 5i used
$( 'html, body' ).animate( { scrollTop: 0 }, 0 );