Jquery Scrolling
Posted
by
Rich - Pixel Vector
on Stack Overflow
See other posts from Stack Overflow
or by Rich - Pixel Vector
Published on 2011-11-16T17:48:07Z
Indexed on
2011/11/16
17:51 UTC
Read the original article
Hit count: 162
I have implemented the following code from this page: http://tympanus.net/codrops/2010/06/02/smooth-vertical-or-horizontal-page-scrolling-with-jquery/
$(document).ready(function() {
$('ul.navone li a, ul.navtwo li a,a.toplink, a.bodylink').bind('click',function(event){
var $anchor = $(this);
$('html, body, header').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1500,'easeInOutExpo');
event.preventDefault();
});
});
This all works correctly.
However, in my layout I have a fixed header div (i.e. it stays in place when the user scrolls). Therefore I need to set an offset for the scrolling script of 117 pixels.
How do I do this please?
© Stack Overflow or respective owner