Solve ScrollTop Jquery not working in Boostrap because overflow:auto

Solve ScrollTop Jquery not working in Boostrap because overflow:auto

Yes, ScrollTop Jquery not working in Boostrap because overflow:auto. To solve this, we need to use div that using “overflow:auto” and solve by :

1
2
3
4
5
6
7
8
9
10
11
12
<script type="text/javascript">
           $(document).ready(function() {
               
                /* smooth scrolling for scroll to top */
                // scroll to top action
                $('a.scroll-top').click(function(event) {
                    jQuery('#main').animate({
                         scrollTop: jQuery('#main').scrollTop() + jQuery('#main').position().top - 3500
                     }, 500);
                });
            });
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.