From 27d170543699d67265b13af752a8a05e20cf09b9 Mon Sep 17 00:00:00 2001 From: sylvainaerni Date: Wed, 19 Aug 2015 11:33:21 +0200 Subject: [PATCH] set a general offset variable --- jquery.fullPage.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jquery.fullPage.js b/jquery.fullPage.js index 0e5ccc1bb..e3c4c059c 100755 --- a/jquery.fullPage.js +++ b/jquery.fullPage.js @@ -124,6 +124,7 @@ scrollOverflow: false, touchSensitivity: 5, normalScrollElementTouchThreshold: 5, + topOffset: 0, //Accessibility keyboardScrolling: true, @@ -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. */ @@ -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 = {