Home > front end >  why smooth scroll JS is not working in my web
why smooth scroll JS is not working in my web

Time:01-28

I need help, I ve been fighting with this whole day, but cant really find a problem why this is not working.

https://jsfiddle.net/bk51xgrq/13/

$(function () {
  $('a[href*="#"]').click(function () {
     var $target = $(this.hash);
     $target = $target.length ? $target : $('html');
     var targetOffset = $target.offset().top;
     $('html,body').animate({scrollTop: targetOffset}, {duration: 8600, easing: 'easeInBounce'});
  });
});

CodePudding user response:

You are using jQuery but you haven't included it in your project. You can link to it using the CDN in your html document

 <!--jQuery -->
   <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj 3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
  •  Tags:  
  • Related