0

I am trying to adjust the speed of a page jump, here is the jQuery I have:

$(document).scroll(function(){
var elem = $('.subnav');
if (!elem.attr('data-top')) {
    if (elem.hasClass('navbar-fixed-top'))
        return;
     var offset = elem.offset()
    elem.attr('data-top', offset.top);
}
if (elem.attr('data-top') - elem.outerHeight() <= $(this).scrollTop() - $(elem).outerHeight())
    elem.addClass('navbar-fixed-top');
else
    elem.removeClass('navbar-fixed-top');

});

I just cant seem to work out where to add:

 900, 'swing', function () {
        window.location.hash = target;

Or something simliar.

madth3
  • 7,275
  • 12
  • 50
  • 74
  • Where do you use waypoints in your code? http://stackoverflow.com/a/8579673/1596547 show howto scroll to an anchor. Use a jquery on click / scoll event to trigger the `scrollToAnchor` b.e. `$('body').on('scroll', function(){scrollToAnchor(target);});` – Bass Jobsen Jun 18 '13 at 20:05
  • Ah ok I see, I was going about it the wrong way really. Cheers I'll look into that. – Harry Rook Jun 18 '13 at 21:22

0 Answers0