phn221181 Posted July 4, 2018 Share Posted July 4, 2018 (edited) hi, i made a small website for my wife. i included jquery in order to use smooth scrolling and scrollspy. without success. Someone can point me the mistake? i checked if i included jquery twice or more. i did not find. i copied this code from w3schools: <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <!--- Stuff between --> <script> /* ### SCROLLING ### */ // Add scrollspy to <body> $('body').scrollspy({target: ".navbar", offset: 50}); // Add smooth scrolling on all links inside the navbar $('#myNavbar li a').on('click', function(event) { // Make sure this.hash has a value before overriding default behavior if (this.hash !== "") { // Prevent default anchor click behavior event.preventDefault(); // Store hash var hash = this.hash; // Using jQuery's animate() method to add smooth page scroll // The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area $('html, body').animate({ scrollTop: $(hash).offset().top }, 800, function(){ // Add hash (#) to URL when done scrolling (default click behavior) window.location.hash = hash; }); } // End if }); </script> code explorer returns: SCRIPT438: Object doesn't support property or method 'scrollspy' check out: this site thanks in advance pat Edited July 4, 2018 by phn221181 Link to comment Share on other sites More sharing options...
Ingolme Posted July 4, 2018 Share Posted July 4, 2018 You need a script tag for the scrollspy plugin in addition to the jQuery one. 1 Link to comment Share on other sites More sharing options...
phn221181 Posted July 4, 2018 Author Share Posted July 4, 2018 (edited) Thx for help, i found the issue. i didnt include the bootstrap.min.js... now it works fine 🙂 thanks Edited July 4, 2018 by phn221181 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now