Looking to implement a smooth scroll feature, I came across an example online and tried to adapt it. Here's the code I'm working with:
https://jsfiddle.net/4DcNH/144/
I've added specific conditions to the html and body elements (changing the context by 50px from the top to accommodate the navbar). However, this adjustment seems to be interfering with the smooth scroll functionality. Does anyone have a solution for this issue? Any help is greatly appreciated.
$(document).ready(function() {
$('a[rel="relativeanchor"]').click(function(){
$('html, body').animate({
scrollTop: $( $.attr(this, 'href') ).offset().top
}, 2000);
return false;
});
});