Skip to content

Commit a95be5e

Browse files
authored
Merge pull request #4389 from alvarotrigo/dev
Merging dev branch 4.0.7
2 parents e558fc7 + 83f28a6 commit a95be5e

23 files changed

+140
-69
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
---
1919

20-
![fullPage.js version](http://img.shields.io/badge/fullPage.js-v4.0.6-brightgreen.svg)
20+
![fullPage.js version](http://img.shields.io/badge/fullPage.js-v4.0.7-brightgreen.svg)
2121
[![License](https://img.shields.io/badge/License-GPL-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.html)
2222
[![PayPal Donate](https://img.shields.io/badge/donate-PayPal.me-ff69b4.svg)](https://www.paypal.me/alvarotrigo/9.95)
2323
[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/fullpage.js/badge?style=rounded)](https://www.jsdelivr.com/package/npm/fullpage.js)
@@ -772,7 +772,7 @@ new fullpage('#fullpage', {
772772
anchors: ['firstPage', 'secondPage', 'thirdPage', 'fourthPage', 'lastPage'],
773773

774774
afterLoad: function(origin, destination, direction, trigger){
775-
var loadedSection = this;
775+
var origin = this;
776776

777777
//using index
778778
if(origin.index == 2){

dist/fullpage.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* fullPage 4.0.6
2+
* fullPage 4.0.7
33
* https://github.com/alvarotrigo/fullPage.js
44
*
55
* @license GPLv3 for open source use only

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: 58 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* fullPage 4.0.6
2+
* fullPage 4.0.7
33
* https://github.com/alvarotrigo/fullPage.js
44
*
55
* @license GPLv3 for open source use only
@@ -1419,10 +1419,10 @@
14191419
var change = to - start;
14201420
var currentTime = 0;
14211421
var increment = 20;
1422+
var isCallbackFired = false;
14221423
setState({
14231424
activeAnimation: true
1424-
});
1425-
var isCallbackFired = false; // Making sure we can trigger a scroll animation
1425+
}); // Making sure we can trigger a scroll animation
14261426
// when css scroll snap is active. Temporally disabling it.
14271427

14281428
if (element === doc.body) {
@@ -2605,7 +2605,7 @@
26052605
this.focusedElem.blur();
26062606
}
26072607

2608-
if ($(OVERFLOW_SEL, getState().activeSection.item)[0]) {
2608+
if ($(OVERFLOW_SEL + ACTIVE_SEL, getState().activeSection.item)[0]) {
26092609
this.focusedElem = $(OVERFLOW_SEL, getState().activeSection.item)[0];
26102610
this.focusedElem.focus();
26112611
}
@@ -3517,9 +3517,12 @@
35173517

35183518
function afterSectionLoads(v) {
35193519
if (getOptions().fitToSection) {
3520-
css(doc.body, {
3521-
'scroll-snap-type': 'y mandatory'
3522-
});
3520+
// Removing CSS snaps for auto-scrolling sections
3521+
if (hasClass($(SECTION_ACTIVE_SEL)[0], AUTO_HEIGHT)) {
3522+
css(doc.body, {
3523+
'scroll-snap-type': 'none'
3524+
});
3525+
}
35233526
}
35243527

35253528
setState({
@@ -3707,12 +3710,6 @@
37073710
function touchMoveHandler(e) {
37083711
var activeSection = closest(e.target, SECTION_SEL) || getState().activeSection.item;
37093712
var hasActiveSectionOverflow = scrollOverflowHandler.isScrollable(getState().activeSection);
3710-
var isVerticalMovementEnough = Math.abs(touchStartY - touchEndY) > win.innerHeight / 100 * getOptions().touchSensitivity;
3711-
var isHorizontalMovementEnough = Math.abs(touchStartX - touchEndX) > getWindowWidth() / 100 * getOptions().touchSensitivity;
3712-
var isHorizontalPredominantMove = $(SLIDES_WRAPPER_SEL, activeSection).length && Math.abs(touchStartX - touchEndX) > Math.abs(touchStartY - touchEndY);
3713-
var directionH = touchStartX > touchEndX ? 'right' : 'left';
3714-
var directionV = touchStartY > touchEndY ? 'down' : 'up';
3715-
var direction = isHorizontalPredominantMove ? directionH : directionV;
37163713

37173714
if (isReallyTouch(e)) {
37183715
setState({
@@ -3730,6 +3727,12 @@
37303727
var touchEvents = getEventsPage(e);
37313728
touchEndY = touchEvents.y;
37323729
touchEndX = touchEvents.x;
3730+
var isVerticalMovementEnough = Math.abs(touchStartY - touchEndY) > win.innerHeight / 100 * getOptions().touchSensitivity;
3731+
var isHorizontalMovementEnough = Math.abs(touchStartX - touchEndX) > getWindowWidth() / 100 * getOptions().touchSensitivity;
3732+
var isHorizontalPredominantMove = $(SLIDES_WRAPPER_SEL, activeSection).length && Math.abs(touchStartX - touchEndX) > Math.abs(touchStartY - touchEndY);
3733+
var directionH = touchStartX > touchEndX ? 'right' : 'left';
3734+
var directionV = touchStartY > touchEndY ? 'down' : 'up';
3735+
var direction = isHorizontalPredominantMove ? directionH : directionV;
37333736
setState({
37343737
touchDirection: direction
37353738
}); //if movement in the X axys is greater than in the Y and the currect section has slides...
@@ -3989,7 +3992,7 @@
39893992

39903993
docAddEvent('keydown', keydownHandler); // for fitToSection:true
39913994

3992-
$body.addEventListener('keydown', cancelDirectionKeyEvents); //to prevent scrolling while zooming
3995+
$body.addEventListener('keydown', onBodyClick); //to prevent scrolling while zooming
39933996

39943997
docAddEvent('keyup', keyUpHandler);
39953998
EventEmitter.on('onDestroy', onDestroy$5);
@@ -3999,19 +4002,23 @@
39994002
clearTimeout(g_keydownId);
40004003
docRemoveEvent('keydown', keydownHandler);
40014004
docRemoveEvent('keyup', keyUpHandler);
4005+
}
4006+
4007+
function isInsideInput() {
4008+
var activeElement = doc.activeElement;
4009+
return matches(activeElement, 'textarea') || matches(activeElement, 'input') || matches(activeElement, 'select') || getAttr(activeElement, 'contentEditable') == "true" || getAttr(activeElement, 'contentEditable') == '';
40024010
} //Sliding with arrow keys, both, vertical and horizontal
40034011

40044012

40054013
function keydownHandler(e) {
40064014
clearTimeout(g_keydownId);
4007-
var activeElement = doc.activeElement;
40084015
var keyCode = e.keyCode;
40094016
var isPressingHorizontalArrows = [37, 39].indexOf(keyCode) > -1;
40104017
var canScrollWithKeyboard = getOptions().autoScrolling || isPressingHorizontalArrows; //tab?
40114018

40124019
if (keyCode === 9) {
40134020
onTab(e);
4014-
} else if (!matches(activeElement, 'textarea') && !matches(activeElement, 'input') && !matches(activeElement, 'select') && getAttr(activeElement, 'contentEditable') !== "true" && getAttr(activeElement, 'contentEditable') !== '' && getOptions().keyboardScrolling && canScrollWithKeyboard) {
4021+
} else if (!isInsideInput() && getOptions().keyboardScrolling && canScrollWithKeyboard) {
40154022
g_controlPressed = e.ctrlKey;
40164023
g_keydownId = setTimeout(function () {
40174024
onkeydown(e);
@@ -4202,8 +4209,20 @@
42024209
}
42034210

42044211
function shouldCancelKeyboardNavigation(e) {
4212+
// https://keycode.info/for/34
4213+
// 40 = arrow down
4214+
// 38 = arrow up
4215+
// 32 = spacebar
4216+
// 33 = PageUp
4217+
// 34 = PageDown
42054218
var keyControls = [40, 38, 32, 33, 34];
42064219
return keyControls.indexOf(e.keyCode) > -1 && !state.isBeyondFullpage;
4220+
}
4221+
4222+
function onBodyClick(e) {
4223+
if (!isInsideInput()) {
4224+
cancelDirectionKeyEvents(e);
4225+
}
42074226
} //preventing the scroll with arrow keys & spacebar & Page Up & Down keys
42084227

42094228

@@ -4953,15 +4972,27 @@
49534972

49544973
setPageStatus(slideIndex, slideAnchorLink, anchorLink);
49554974
updateState();
4956-
} //small timeout in order to avoid entering in hashChange event when scrolling is not finished yet
4957-
4975+
}
49584976

4959-
clearTimeout(g_scrollId);
4960-
g_scrollId = setTimeout(function () {
4961-
setState({
4962-
isScrolling: false
4963-
});
4964-
}, 100);
4977+
if (getOptions().fitToSection) {
4978+
// Small timeout in order to avoid entering in hashChange event when scrolling is not finished yet
4979+
clearTimeout(g_scrollId);
4980+
g_scrollId = setTimeout(function () {
4981+
setState({
4982+
isScrolling: false
4983+
});
4984+
var fixedSections = state.sections.filter(function (section) {
4985+
var sectionValues = section.item.getBoundingClientRect();
4986+
return Math.round(sectionValues.bottom) === Math.round(getWindowHeight()) || Math.round(sectionValues.top) === 0;
4987+
}); // No section is fitting the viewport? Let's fix that!
4988+
4989+
if (!fixedSections.length) {
4990+
css(doc.body, {
4991+
'scroll-snap-type': 'y mandatory'
4992+
});
4993+
}
4994+
}, 300);
4995+
}
49654996
}
49664997
}
49674998
}
@@ -5124,7 +5155,7 @@
51245155
});
51255156
});
51265157
var t = ["-"];
5127-
var n = "2022-3-19".split("-"),
5158+
var n = "2022-4-9".split("-"),
51285159
e = new Date(n[0], n[1], n[2]),
51295160
i = ["se", "licen", "-", "v3", "l", "gp"];
51305161

@@ -5133,7 +5164,7 @@
51335164
}
51345165

51355166
function o(t) {
5136-
return isNaN(t) ? t.charCodeAt(0) - 72 : t;
5167+
return t ? isNaN(t) ? t.charCodeAt(0) - 72 : t : "";
51375168
}
51385169

51395170
function a(t) {
@@ -5540,7 +5571,7 @@
55405571
}; //public functions
55415572

55425573

5543-
FP.version = '4.0.6';
5574+
FP.version = '4.0.7';
55445575
FP.test = Object.assign(FP.test, {
55455576
top: '0px',
55465577
translate3d: 'translate3d(0px, 0px, 0px)',

dist/fullpage.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/fullpage.min.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/fullpage.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.

lang/chinese/README.md

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

1717
---
1818

19-
![fullPage.js version](http://img.shields.io/badge/fullPage.js-v4.0.6,2-brightgreen.svg)
19+
![fullPage.js version](http://img.shields.io/badge/fullPage.js-v4.0.7,2-brightgreen.svg)
2020
[![License](https://img.shields.io/badge/License-GPL-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.html)
2121
[![PayPal Donate](https://img.shields.io/badge/donate-PayPal.me-ff69b4.svg)](https://www.paypal.me/alvarotrigo/9.95)
2222
[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/fullpage.js/badge?style=rounded)](https://www.jsdelivr.com/package/npm/fullpage.js)

lang/french/README.md

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

1818
---
1919

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

lang/korean/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</p>
1717
---
1818

19-
![fullPage.js version](http://img.shields.io/badge/fullPage.js-v4.0.6-brightgreen.svg)
19+
![fullPage.js version](http://img.shields.io/badge/fullPage.js-v4.0.7-brightgreen.svg)
2020
[![License](https://img.shields.io/badge/License-GPL-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.html)
2121
[![PayPal](https://img.shields.io/badge/donate-PayPal.me-ff69b4.svg)](https://www.paypal.me/alvarotrigo/9.95)
2222
[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/fullpage.js/badge?style=rounded)](https://www.jsdelivr.com/package/npm/fullpage.js)

0 commit comments

Comments
 (0)