Skip to content

Commit 7df75bd

Browse files
committed
- Added new option bigSectionsDestination to define the destination for big sections when using fp-auto-height alvarotrigo#1854
1 parent ffabc5b commit 7df75bd

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,10 @@
33
![preview](https://raw.github.com/alvarotrigo/fullPage.js/master/examples/imgs/intro.png)
44
![compatibility](https://raw.github.com/alvarotrigo/fullPage.js/master/examples/imgs/compatible.gif)
55

6-
![fullPage.js version](http://img.shields.io/badge/fullPage.js-v2.8.1-brightgreen.svg)
6+
![fullPage.js version](http://img.shields.io/badge/fullPage.js-v2.8.2-brightgreen.svg)
77
[![License](http://img.shields.io/badge/License-MIT-blue.svg)](http://opensource.org/licenses/MIT)
88
7Kb gziped!
99

10-
----
11-
**Make sure to use at least version 2.7.6.** A dangerous security issue has been found in previous versions!
12-
13-
---
14-
1510
A simple and easy to use plugin to create fullscreen scrolling websites (also known as single page websites or onepage sites).
1611
It allows the creation of fullscreen scrolling websites, as well as adding some landscape sliders inside the sections of the site.
1712

@@ -173,6 +168,7 @@ $(document).ready(function() {
173168
scrollOverflowOptions: null,
174169
touchSensitivity: 15,
175170
normalScrollElementTouchThreshold: 5,
171+
bigSectionsDestination: null,
176172

177173
//Accessibility
178174
keyboardScrolling: true,
@@ -352,6 +348,8 @@ the fitting by the configured milliseconds.
352348

353349
- `normalScrollElementTouchThreshold` : (default `5`) Defines the threshold for the number of hops up the html node tree Fullpage will test to see if `normalScrollElements` is a match to allow scrolling functionality on divs on a touch device. (For example: `normalScrollElementTouchThreshold: 3`)
354350

351+
- `bigSectionsDestination`: (default `null`) Defines how to scroll to a section which size is bigger than the viewport. By default fullPage.js scrolls to the top if you come from a section above the destination one and to the bottom if you come from a section below the destination one. Possible values are `top`, `bottom`, `null`.
352+
355353
- `keyboardScrolling`: (default `true`) Defines if the content can be navigated using the keyboard
356354

357355
- `touchSensitivity`: (default `5`) Defines a percentage of the browsers window width/height, and how far a swipe must measure for navigating to the next section / slide

jquery.fullPage.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
scrollOverflowOptions: null,
141141
touchSensitivity: 5,
142142
normalScrollElementTouchThreshold: 5,
143+
bigSectionsDestination: null,
143144

144145
//Accessibility
145146
keyboardScrolling: true,
@@ -1001,6 +1002,9 @@
10011002

10021003
lastScroll = currentScroll;
10031004

1005+
//needed for auto-height sections to determine if we want to scroll to the top or bottom of the destination
1006+
previousDestTop = currentScroll;
1007+
10041008
return direction;
10051009
}
10061010

@@ -1303,11 +1307,12 @@
13031307
var position = elemPosition.top;
13041308
var isScrollingDown = elemPosition.top > previousDestTop;
13051309
var sectionBottom = position - windowsHeight + element.outerHeight();
1310+
var bigSectionsDestination = options.bigSectionsDestination;
13061311

13071312
//is the destination element bigger than the viewport?
13081313
if(element.outerHeight() > windowsHeight){
1309-
//scrolling up?
1310-
if(!isScrollingDown){
1314+
//scrolling up?
1315+
if(!isScrollingDown && !bigSectionsDestination || bigSectionsDestination === 'bottom' ){
13111316
position = sectionBottom;
13121317
}
13131318
}

0 commit comments

Comments
 (0)