I am currently using JS SmoothScroll on my main navigation to navigate smoothly around a one page website. You can see it working fine here on the main navigation. It’s called by adding class=”scroll” to the link. The script can be seen here.
I’m trying to use the same javascript for my ‘back to top’ feature. At present the back to top feature works fine but it just ‘snaps’ to top so I’d like it to scroll like my other navigation does.
However, when I add class=”scroll” to that link, it stops working altogether.
The jQuery script you linked to will only scroll to an element by
name, and you are using anid. Either modify the script to scroll to elements byid, or change the top element to have anameinstead.Note that the use of
nameattributes as anchors is generally frowned upon, so I would suggest updating the jQuery to useid, and updating all the other anchors on your page to haveidattributes too.