Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- $(document).ready(function() {
- var hashTagActive = "";
- $(".scroll").click(function (event) {
- if(hashTagActive != this.hash) {
- event.preventDefault();
- var dest = 0;
- if ($(this.hash).offset().top > $(document).height() - $(window).height()) {
- dest = $(document).height() - $(window).height();
- } else {
- dest = $(this.hash).offset().top;
- }
- $('html,body').animate({
- scrollTop: dest
- }, 2000, 'swing');
- hashTagActive = this.hash;
- }
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement