Skip to content

Commit 09c5a67

Browse files
authored
Merge pull request #4395 from alvarotrigo/dev
Merging dev branch 4.0.8
2 parents a95be5e + 7a73073 commit 09c5a67

22 files changed

+125
-76
lines changed

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.7-brightgreen.svg)
20+
![fullPage.js version](http://img.shields.io/badge/fullPage.js-v4.0.8-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)

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.7
2+
* fullPage 4.0.8
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: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* fullPage 4.0.7
2+
* fullPage 4.0.8
33
* https://github.com/alvarotrigo/fullPage.js
44
*
55
* @license GPLv3 for open source use only
@@ -885,9 +885,9 @@
885885
return state;
886886
}
887887

888-
EventEmitter.on('bindEvents', bindEvents$d);
888+
EventEmitter.on('bindEvents', bindEvents$c);
889889

890-
function bindEvents$d() {
890+
function bindEvents$c() {
891891
//Scrolls to the section when clicking the navigation bullet
892892
//simulating the jQuery .on('click') event using delegation
893893
['click', 'touchstart'].forEach(function (eventName) {
@@ -898,7 +898,7 @@
898898
}
899899

900900
function internalEvents() {
901-
EventEmitter.on('onDestroy', onDestroy$9);
901+
EventEmitter.on('onDestroy', onDestroy$8);
902902
}
903903

904904
function delegatedEvents(e) {
@@ -908,7 +908,7 @@
908908
});
909909
}
910910

911-
function onDestroy$9() {
911+
function onDestroy$8() {
912912
['click', 'touchstart'].forEach(function (eventName) {
913913
docRemoveEvent(eventName, delegatedEvents);
914914
});
@@ -1398,28 +1398,16 @@
13981398
}
13991399

14001400
//@ts-check
1401-
var g_animateScrollId;
1402-
EventEmitter.on('bindEvents', bindEvents$c);
1403-
1404-
function bindEvents$c() {
1405-
EventEmitter.on('onDestroy', onDestroy$8);
1406-
}
1407-
1408-
function onDestroy$8() {
1409-
clearTimeout(g_animateScrollId);
1410-
}
14111401
/**
14121402
* Simulates the animated scrollTop of jQuery. Used when css3:false or scrollBar:true or autoScrolling:false
14131403
* http://stackoverflow.com/a/16136789/1081396
14141404
*/
14151405

1416-
14171406
function scrollTo(element, to, duration, callback) {
14181407
var start = getScrolledPosition(element);
14191408
var change = to - start;
1420-
var currentTime = 0;
1421-
var increment = 20;
14221409
var isCallbackFired = false;
1410+
var startTime;
14231411
setState({
14241412
activeAnimation: true
14251413
}); // Making sure we can trigger a scroll animation
@@ -1431,22 +1419,28 @@
14311419
});
14321420
}
14331421

1434-
var animateScroll = function animateScroll() {
1422+
var animateScroll = function animateScroll(timestamp) {
14351423
if (state.activeAnimation) {
14361424
//in order to stope it from other function whenever we want
14371425
var val = to;
1438-
currentTime += increment;
1426+
1427+
if (!startTime) {
1428+
startTime = timestamp;
1429+
}
1430+
1431+
var currentTime = Math.floor(timestamp - startTime);
14391432

14401433
if (duration) {
14411434
// @ts-ignore
14421435
val = win.fp_easings[getOptions().easing](currentTime, start, change, duration);
14431436
}
14441437

1445-
setScrolling(element, val);
1438+
if (currentTime <= duration) {
1439+
setScrolling(element, val);
1440+
}
14461441

14471442
if (currentTime < duration) {
1448-
clearTimeout(g_animateScrollId);
1449-
g_animateScrollId = setTimeout(animateScroll, increment);
1443+
window.requestAnimationFrame(animateScroll);
14501444
} else if (typeof callback !== 'undefined' && !isCallbackFired) {
14511445
callback();
14521446
isCallbackFired = true;
@@ -1457,7 +1451,7 @@
14571451
}
14581452
};
14591453

1460-
animateScroll();
1454+
window.requestAnimationFrame(animateScroll);
14611455
}
14621456
/**
14631457
* Getting the position of the element to scroll when using jQuery animations
@@ -2657,7 +2651,7 @@
26572651
var scrollableItem = scrollOverflowHandler.scrollable(el);
26582652
var positionY = scrollableItem.scrollTop;
26592653
var isTopReached = direction === 'up' && positionY <= 0;
2660-
var isBottomReached = direction === 'down' && scrollableItem.scrollHeight <= scrollableItem.offsetHeight + positionY;
2654+
var isBottomReached = direction === 'down' && scrollableItem.scrollHeight <= Math.ceil(scrollableItem.offsetHeight + positionY);
26612655
var isScrolled = isTopReached || isBottomReached;
26622656

26632657
if (!isScrolled) {
@@ -2833,7 +2827,7 @@
28332827
FP.render = onContentChange;
28342828

28352829
function bindEvents$9() {
2836-
if (getOptions().observer && "MutationObserver" in window) {
2830+
if (getOptions().observer && "MutationObserver" in window && $(WRAPPER_SEL)[0]) {
28372831
g_wrapperObserver = createObserver($(WRAPPER_SEL)[0], onContentChange, g_wrapperObserveConfig);
28382832
}
28392833

@@ -2905,7 +2899,7 @@
29052899
});
29062900
}
29072901

2908-
if (getOptions().observer && g_wrapperObserver) {
2902+
if (getOptions().observer && g_wrapperObserver && $(WRAPPER_SEL)[0]) {
29092903
g_wrapperObserver.observe($(WRAPPER_SEL)[0], g_wrapperObserveConfig);
29102904
}
29112905
}
@@ -3648,14 +3642,18 @@
36483642
var touchEndX = 0;
36493643
var MSPointer = getMSPointer();
36503644
var events = {
3651-
touchmove: 'ontouchmove' in window ? 'touchmove' : MSPointer.move,
3652-
touchstart: 'ontouchstart' in window ? 'touchstart' : MSPointer.down
3645+
touchmove: 'ontouchmove' in window ? 'touchmove' : MSPointer ? MSPointer.move : null,
3646+
touchstart: 'ontouchstart' in window ? 'touchstart' : MSPointer ? MSPointer.down : null
36533647
};
36543648
/**
36553649
* Adds the possibility to auto scroll through sections on touch devices.
36563650
*/
36573651

36583652
function addTouchHandler() {
3653+
if (!events.touchmove) {
3654+
return;
3655+
}
3656+
36593657
if (isTouchDevice || isTouch) {
36603658
if (getOptions().autoScrolling) {
36613659
$body.removeEventListener(events.touchmove, preventBouncing, {
@@ -3682,6 +3680,10 @@
36823680
*/
36833681

36843682
function removeTouchHandler() {
3683+
if (!events.touchmove) {
3684+
return;
3685+
}
3686+
36853687
if (isTouchDevice || isTouch) {
36863688
// normalScrollElements requires it off #2691
36873689
if (getOptions().autoScrolling) {
@@ -4548,6 +4550,7 @@
45484550
var windowsWidth = getWindowWidth();
45494551
var g_resizeId;
45504552
var g_isConsecutiveResize = false;
4553+
var g_resizeMobileHandlerId;
45514554
FP.reBuild = reBuild;
45524555
EventEmitter.on('bindEvents', bindEvents$6);
45534556

@@ -4559,6 +4562,7 @@
45594562

45604563
function onDestroy$3() {
45614564
clearTimeout(g_resizeId);
4565+
clearTimeout(g_resizeMobileHandlerId);
45624566
windowRemoveEvent('resize', resizeHandler);
45634567
}
45644568
/*
@@ -4573,6 +4577,7 @@
45734577
}
45744578
}
45754579

4580+
fitToActiveSection();
45764581
g_isConsecutiveResize = true; //in order to call the functions only when the resize is finished
45774582
//http://stackoverflow.com/questions/4298612/jquery-how-to-call-resize-event-only-once-its-finished-resizing
45784583

@@ -4586,6 +4591,26 @@
45864591
g_isConsecutiveResize = false; // }
45874592
}, 400);
45884593
}
4594+
4595+
function fitToActiveSection() {
4596+
if (isTouchDevice) {
4597+
// Issue #4393 and previously in v3, #3336
4598+
// (some apps or browsers, like Chrome/Firefox will delay a bit to scroll
4599+
// to the focused input
4600+
for (var i = 0; i < 4; i++) {
4601+
g_resizeMobileHandlerId = setTimeout(function () {
4602+
window.requestAnimationFrame(function () {
4603+
// on Android devices the browser scrolls to the focused element
4604+
// messing up the whole page structure. So we need to update the
4605+
// translate3d value when the keyboard shows/hides
4606+
if (getOptions().autoScrolling && !getOptions().scrollBar) {
4607+
silentMoveTo(state.activeSection.index() + 1);
4608+
}
4609+
});
4610+
}, 200 * i);
4611+
}
4612+
}
4613+
}
45894614
/**
45904615
* When resizing the site, we adjust the heights of the sections, slimScroll...
45914616
*/
@@ -5155,7 +5180,7 @@
51555180
});
51565181
});
51575182
var t = ["-"];
5158-
var n = "2022-4-9".split("-"),
5183+
var n = "2022-4-20".split("-"),
51595184
e = new Date(n[0], n[1], n[2]),
51605185
i = ["se", "licen", "-", "v3", "l", "gp"];
51615186

@@ -5571,7 +5596,7 @@
55715596
}; //public functions
55725597

55735598

5574-
FP.version = '4.0.7';
5599+
FP.version = '4.0.8';
55755600
FP.test = Object.assign(FP.test, {
55765601
top: '0px',
55775602
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.7,2-brightgreen.svg)
19+
![fullPage.js version](http://img.shields.io/badge/fullPage.js-v4.0.8,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.7-brightgreen.svg)
20+
![fullPage.js version](http://img.shields.io/badge/fullPage.js-v4.0.8-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.7-brightgreen.svg)
19+
![fullPage.js version](http://img.shields.io/badge/fullPage.js-v4.0.8-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)