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 = {