Skip to content

Commit 4eb5d77

Browse files
authored
Merge pull request #4709 from alvarotrigo/dev
Merging dev branch 4.0.36
2 parents aeb7ef3 + 2813e0c commit 4eb5d77

31 files changed

+159
-68
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22
.idea
33
.ignore/
44
.vscode/*
5+
.history/
56
bower_components/
67
node_modules/
78
**/node_modules/
89
package-lock.json
910
src/fullpage.extensions.js
1011
src/js-extensions/**
1112
src/js-limited/**
13+
src/css-limited/**
1214
src/js/mixed/index.js
1315
dist/fullpage.extensions.js
1416
dist/fullpage.limited.js
1517
dist/fullpage.limited.min.js
18+
dist/fullpage.limited.min.css
1619
examples/bug**
1720
gulp/secret.js
1821
build/**

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
---
2121

22-
![fullPage.js version](https://img.shields.io/badge/fullPage.js-v4.0.35-brightgreen.svg)
22+
![fullPage.js version](https://img.shields.io/badge/fullPage.js-v4.0.36-brightgreen.svg)
2323
[![License](https://img.shields.io/badge/License-GPL-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.html)
2424
[![PayPal Donate](https://img.shields.io/badge/donate-PayPal.me-ff69b4.svg)](https://www.paypal.me/alvarotrigo/9.95)
2525
[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/fullpage.js/badge?style=rounded)](https://www.jsdelivr.com/package/npm/fullpage.js)

dist/fullpage.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* fullPage 4.0.35
2+
* fullPage 4.0.36
33
* https://github.com/alvarotrigo/fullPage.js
44
*
55
* @license GPLv3 for open source use only
@@ -256,7 +256,7 @@ body:not(.fp-responsive) .fp-overflow{
256256

257257
.fp-is-overflow .fp-overflow.fp-auto-height-responsive,
258258
.fp-is-overflow .fp-overflow.fp-auto-height,
259-
.fp-is-overflow > .fp-overflow{
259+
.fp-is-overflow .fp-overflow{
260260
overflow-y: auto;
261261
}
262262
.fp-overflow{

dist/fullpage.extensions.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/fullpage.js

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* fullPage 4.0.35
2+
* fullPage 4.0.36
33
* https://github.com/alvarotrigo/fullPage.js
44
*
55
* @license GPLv3 for open source use only
@@ -953,7 +953,7 @@
953953
}
954954
};
955955

956-
var state = {
956+
var defaultState = {
957957
numSections: 0,
958958
numSlides: 0,
959959
slides: [],
@@ -981,7 +981,8 @@
981981
scrollY: 0,
982982
scrollX: 0,
983983
isFullpageInitDone: false
984-
}; // @ts-ignore
984+
};
985+
var state = Object.assign({}, defaultState); // @ts-ignore
985986

986987
win.state = state;
987988
function setState(props) {
@@ -993,6 +994,9 @@
993994
function getActivePanel() {
994995
return state.activeSection && state.activeSection.activeSlide ? state.activeSection.activeSlide : state.activeSection;
995996
}
997+
function resetState() {
998+
setState(defaultState);
999+
}
9961000

9971001
var events = {
9981002
onAfterRenderNoAnchor: 'onAfterRenderNoAnchor',
@@ -1003,6 +1007,7 @@
10031007
beforeInit: 'beforeInit',
10041008
bindEvents: 'bindEvents',
10051009
onDestroy: 'onDestroy',
1010+
onDestroyAll: 'onDestroyAll',
10061011
contentChanged: 'contentChanged',
10071012
onScrollOverflowScrolled: 'onScrollOverflowScrolled',
10081013
onScrollPageAndSlide: 'onScrollPageAndSlide',
@@ -1908,11 +1913,17 @@
19081913
return anchor;
19091914
}
19101915

1916+
EventEmitter.on(events.onDestroyAll, onDestroyAll$1);
1917+
1918+
function onDestroyAll$1() {
1919+
setUrlHash('');
1920+
}
19111921
/**
19121922
* Sets the state of the website depending on the active section/slide.
19131923
* It changes the URL hash when needed and updates the body class.
19141924
*/
19151925

1926+
19161927
function setPageStatus(slideIndex, slideAnchor, anchorLink) {
19171928
var sectionHash = '';
19181929

@@ -1953,13 +1964,7 @@
19531964
if (getOptions().recordHistory) {
19541965
location.hash = url;
19551966
} else {
1956-
//Mobile Chrome doesn't work the normal way, so... lets use HTML5 for phones :)
1957-
if (isTouchDevice || isTouch) {
1958-
win.history.replaceState(undefined, undefined, '#' + url);
1959-
} else {
1960-
var baseUrl = win.location.href.split('#')[0];
1961-
win.location.replace(baseUrl + '#' + url);
1962-
}
1967+
win.history.replaceState(undefined, undefined, '#' + url);
19631968
}
19641969
}
19651970

@@ -2191,6 +2196,18 @@
21912196
}
21922197
}
21932198

2199+
function getTmpPosition(v) {
2200+
return hasClass(getState().activeSection.item, AUTO_HEIGHT) ? getDestinationPosition(getState().activeSection.item) : getState().activeSection.item.offsetTop;
2201+
}
2202+
function getDestinationPosForInfiniteScroll(v) {
2203+
// forcing the scroll to the bottom of the fp-auto-height section when scrolling up
2204+
if (v.isMovementUp && hasClass(v.element, AUTO_HEIGHT)) {
2205+
return getDestinationPosition(v.element) - getWindowHeight() + v.element.offsetHeight;
2206+
}
2207+
2208+
return v.element.offsetTop;
2209+
}
2210+
21942211
//@ts-check
21952212
/**
21962213
* Adds sections before or after the current one to create the infinite effect.
@@ -2204,21 +2221,22 @@
22042221

22052222
if (!v.isMovementUp) {
22062223
// Move all previous sections to after the active section
2207-
after(activeSectionItem, prevAll(activeSectionItem, SECTION_SEL).reverse());
2224+
var prevSectionsReversed = prevAll(activeSectionItem, SECTION_SEL).reverse();
2225+
after(activeSectionItem, prevSectionsReversed[0]);
22082226
} else {
22092227
// Scrolling up
22102228
// Move all next sections to before the active section
22112229
before(activeSectionItem, nextAll(activeSectionItem, SECTION_SEL));
22122230
} // Maintain the displayed position (now that we changed the element order)
22132231

22142232

2215-
silentScroll(getState().activeSection.item.offsetTop); // Maintain the active slides visible in the viewport
2233+
silentScroll(getTmpPosition()); // Maintain the active slides visible in the viewport
22162234

22172235
keepSlidesPosition$1(); // save for later the elements that still need to be reordered
22182236

22192237
v.wrapAroundElements = activeSectionItem; // Recalculate animation variables
22202238

2221-
v.dtop = v.element.offsetTop;
2239+
v.dtop = getDestinationPosForInfiniteScroll(v);
22222240
v.yMovement = getYmovement(getState().activeSection, v.element);
22232241
return v;
22242242
}
@@ -2263,10 +2281,10 @@
22632281
if (v.isMovementUp) {
22642282
before($(SECTION_SEL)[0], v.wrapAroundElements);
22652283
} else {
2266-
after($(SECTION_SEL)[getState().sections.length - 1], v.wrapAroundElements);
2284+
after($(SECTION_SEL)[getState().sections.length - 1], prevAll(v.element, SECTION_SEL).reverse());
22672285
}
22682286

2269-
silentScroll(getState().activeSection.item.offsetTop); // Maintain the active slides visible in the viewport
2287+
silentScroll(getTmpPosition()); // Maintain the active slides visible in the viewport
22702288

22712289
keepSlidesPosition();
22722290
setState({
@@ -2614,7 +2632,6 @@
26142632
* Performs the vertical movement (by CSS3 or by jQuery)
26152633
*/
26162634

2617-
26182635
function performMovement(v) {
26192636
setState({
26202637
touchDirection: 'none',
@@ -3322,10 +3339,17 @@
33223339

33233340
var g_prevActiveSectionIndex = null;
33243341
var g_prevActiveSlideIndex = null;
3342+
EventEmitter.on(events.onDestroyAll, onDestroyAll);
3343+
3344+
function onDestroyAll() {
3345+
g_prevActiveSectionIndex = null;
3346+
g_prevActiveSlideIndex = null;
3347+
}
33253348
/**
33263349
* Updates the state of the app.
33273350
*/
33283351

3352+
33293353
function updateState() {
33303354
state.activeSection = null;
33313355
state.sections.map(function (section) {
@@ -3404,7 +3428,7 @@
34043428
var activeSectionHasSlides = state.activeSection ? state.activeSection.slides.length : false;
34053429
var activeSlide = state.activeSection ? state.activeSection.activeSlide : null; // Hidding / removing the active section ?
34063430

3407-
if (!activeSection && state.sections.length && !getState().isBeyondFullpage && g_prevActiveSectionIndex) {
3431+
if (!activeSection && state.sections.length && !getState().isBeyondFullpage && g_prevActiveSectionIndex !== null) {
34083432
var newActiveSection = getNewActivePanel(g_prevActiveSectionIndex, state.sections);
34093433

34103434
if (newActiveSection) {
@@ -3418,7 +3442,7 @@
34183442
}
34193443
}
34203444

3421-
if (activeSectionHasSlides && !activeSlide && g_prevActiveSlideIndex) {
3445+
if (activeSectionHasSlides && !activeSlide && g_prevActiveSlideIndex !== null) {
34223446
var newActiveSlide = getNewActivePanel(g_prevActiveSlideIndex, state.activeSection.slides);
34233447

34243448
if (newActiveSlide) {
@@ -3559,6 +3583,7 @@
35593583
characterData: true
35603584
};
35613585
EventEmitter.on(events.bindEvents, bindEvents$9);
3586+
EventEmitter.on(events.onDestroy, unbindEvents);
35623587
FP["render"] = onContentChange;
35633588

35643589
function bindEvents$9() {
@@ -3568,6 +3593,13 @@
35683593

35693594
EventEmitter.on(events.contentChanged, onContentChange);
35703595
}
3596+
3597+
function unbindEvents() {
3598+
if (g_wrapperObserver) {
3599+
g_wrapperObserver.disconnect();
3600+
g_wrapperObserver = null;
3601+
}
3602+
}
35713603
/**
35723604
* Creates a Mutation observer.
35733605
*/
@@ -4717,7 +4749,7 @@
47174749

47184750
scrollings.push(Math.abs(value)); //preventing to scroll the site on mouse wheel when scrollbar is present
47194751

4720-
if (getOptions().scrollBar) {
4752+
if (getOptions().scrollBar || !getOptions().scrollOverflow) {
47214753
preventDefault(e);
47224754
} //time difference between the last scroll and the current one
47234755

@@ -5570,7 +5602,7 @@
55705602
});
55715603
});
55725604
var t = ["-"];
5573-
var n = "\x32\x30\x32\x35\x2d\x33\x2d\x31".split("-"),
5605+
var n = "\x32\x30\x32\x35\x2d\x35\x2d\x32".split("-"),
55745606
e = new Date(n[0], n[1], n[2]),
55755607
r = ["se", "licen", "-", "v3", "l", "gp"];
55765608

@@ -5880,6 +5912,8 @@
58805912
usedSelectors.forEach(function (item) {
58815913
removeClass($('.' + item), item);
58825914
});
5915+
resetState();
5916+
EventEmitter.emit(events.onDestroyAll);
58835917
}
58845918

58855919
FP.destroy = destroy;
@@ -6031,7 +6065,7 @@
60316065
}; //public functions
60326066

60336067

6034-
FP.version = '4.0.35';
6068+
FP.version = '4.0.36';
60356069
FP.test = Object.assign(FP.test, {
60366070
top: '0px',
60376071
translate3d: 'translate3d(0px, 0px, 0px)',

dist/fullpage.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)