Quantcast
Channel: SharePoint 2010 - General Discussions and Questions forum
Viewing all articles
Browse latest Browse all 17574

Scroll page to ANY anchor point

$
0
0

Hi

I've created a Publishing page and added contents and Bookmarks (Anchors).  I've tried to add smooth scrolling using jquery but it doesnt work. I want to be able to scroll to ANY anchor on the page.

I added a HTML form webpart at the top of page using SP UI. Added code from http://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 its failing? Has anyone got this to work in SharePoint?

Thanks

Viewing all articles
Browse latest Browse all 17574

Trending Articles