Tell me, please, how to implement a smooth scrolling page?

1 answer 1

For some reason, as always, when you ask a question, you immediately find the answer. Answer:

<script src="js/jquery-библиотека.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $('a[href*=#]').bind("click", function(e){ var anchor = $(this); $('html, body').stop().animate({ scrollTop: $(anchor.attr('href')).offset().top }, 1000); e.preventDefault(); }); return false; }); </script> 

In the link id = "top" or whatever.

  • one
    Because there is an incomprehensible porridge in the head, which the brain somehow recognizes "understandably". But when you need to bring your question to other participants, you bring it into a common, understandable to all, view. Therefore, first formulate for yourself a question that will be clear to everyone, then look for the answer to this question in the search, and if you can, then ask it on a profile forum, like a hashcode :) I always roll like that. - lampa