I've created a Publishing page and added contents and Bookmarks (Anchors). I've tried to add smooth scrolling using jquery but it doesn't work. I want to be able to scroll to ANY anchor on the page.
I added an HTML form web part at the top of the page using SP UI. Added code from https://stackoverflow.com/questions/4198041/jquery-smooth-scroll-to-an-anchor
$('a[href*=#]').click(function () {
var hash = $(this).attr('href');
hash = hash.slice(hash.indexOf('#') + 1);
$.scrollTo(hash == 'top' ? 0 : 'a[name='+hash+']', 500);
window.location.hash = '#' + hash;
return false;
});
Does anyone have any ideas why it's failing? Has anyone got this to work in SharePoint?
Thanks