Lucy MacGregor Lucy MacGregor - 2 years ago 114
HTML Question

Smooth Scroll for anchor links not working

I'm trying to get a smooth scroll effect for my anchor links on a clients website. For some reason the anchors stop working at all when I add the scroll code. I tried doing a pen with just a nav and the code and it worked fine, so it must be something else on my page causing the issue, help please?? <-- its a bit barren but I had to delete the clients content for their privacy

(function($) { 

$(document).ready(function() {

$(function() {

$('nav#cssmenu a').bind('click', function(event) {
var $anchor = $(this);

$('html, body').stop().animate({
scrollTop: ($($anchor.attr('href')).offset().top - 95)
}, 1500, 'easeInOutExpo');




Answer Source

Try to use linear and swing easing. You can find more info here Easing functions in jQuery

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download