Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set a general offset variable #1454

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion jquery.fullPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
scrollOverflow: false,
touchSensitivity: 5,
normalScrollElementTouchThreshold: 5,
topOffset: 0,

//Accessibility
keyboardScrolling: true,
Expand Down Expand Up @@ -245,6 +246,13 @@
options.lockAnchors = value;
};

/**
* Sets topOffset variable
*/
FP.setTopOffset = function(value){
options.topOffset = value;
};

/**
* Adds or remove the possiblity of scrolling through sections by using the mouse wheel or the trackpad.
*/
Expand Down Expand Up @@ -1202,7 +1210,7 @@
if(typeof dest === 'undefined'){ return; } //there's no element to scroll, leaving the function

//auto height? Scrolling only a bit, the next element's height. Otherwise the whole viewport.
var dtop = element.hasClass(AUTO_HEIGHT) ? (dest.top - windowsHeight + element.height()) : dest.top;
var dtop = element.hasClass(AUTO_HEIGHT) ? ( dest.top - windowsHeight + element.height() + options.topOffset ) : ( dest.top + options.topOffset );

//local variables
var v = {
Expand Down