|
1 | 1 | /*!
|
2 |
| -* fullPage 4.0.7 |
| 2 | +* fullPage 4.0.8 |
3 | 3 | * https://github.com/alvarotrigo/fullPage.js
|
4 | 4 | *
|
5 | 5 | * @license GPLv3 for open source use only
|
|
885 | 885 | return state;
|
886 | 886 | }
|
887 | 887 |
|
888 |
| - EventEmitter.on('bindEvents', bindEvents$d); |
| 888 | + EventEmitter.on('bindEvents', bindEvents$c); |
889 | 889 |
|
890 |
| - function bindEvents$d() { |
| 890 | + function bindEvents$c() { |
891 | 891 | //Scrolls to the section when clicking the navigation bullet
|
892 | 892 | //simulating the jQuery .on('click') event using delegation
|
893 | 893 | ['click', 'touchstart'].forEach(function (eventName) {
|
|
898 | 898 | }
|
899 | 899 |
|
900 | 900 | function internalEvents() {
|
901 |
| - EventEmitter.on('onDestroy', onDestroy$9); |
| 901 | + EventEmitter.on('onDestroy', onDestroy$8); |
902 | 902 | }
|
903 | 903 |
|
904 | 904 | function delegatedEvents(e) {
|
|
908 | 908 | });
|
909 | 909 | }
|
910 | 910 |
|
911 |
| - function onDestroy$9() { |
| 911 | + function onDestroy$8() { |
912 | 912 | ['click', 'touchstart'].forEach(function (eventName) {
|
913 | 913 | docRemoveEvent(eventName, delegatedEvents);
|
914 | 914 | });
|
|
1398 | 1398 | }
|
1399 | 1399 |
|
1400 | 1400 | //@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 |
| - } |
1411 | 1401 | /**
|
1412 | 1402 | * Simulates the animated scrollTop of jQuery. Used when css3:false or scrollBar:true or autoScrolling:false
|
1413 | 1403 | * http://stackoverflow.com/a/16136789/1081396
|
1414 | 1404 | */
|
1415 | 1405 |
|
1416 |
| - |
1417 | 1406 | function scrollTo(element, to, duration, callback) {
|
1418 | 1407 | var start = getScrolledPosition(element);
|
1419 | 1408 | var change = to - start;
|
1420 |
| - var currentTime = 0; |
1421 |
| - var increment = 20; |
1422 | 1409 | var isCallbackFired = false;
|
| 1410 | + var startTime; |
1423 | 1411 | setState({
|
1424 | 1412 | activeAnimation: true
|
1425 | 1413 | }); // Making sure we can trigger a scroll animation
|
|
1431 | 1419 | });
|
1432 | 1420 | }
|
1433 | 1421 |
|
1434 |
| - var animateScroll = function animateScroll() { |
| 1422 | + var animateScroll = function animateScroll(timestamp) { |
1435 | 1423 | if (state.activeAnimation) {
|
1436 | 1424 | //in order to stope it from other function whenever we want
|
1437 | 1425 | var val = to;
|
1438 |
| - currentTime += increment; |
| 1426 | + |
| 1427 | + if (!startTime) { |
| 1428 | + startTime = timestamp; |
| 1429 | + } |
| 1430 | + |
| 1431 | + var currentTime = Math.floor(timestamp - startTime); |
1439 | 1432 |
|
1440 | 1433 | if (duration) {
|
1441 | 1434 | // @ts-ignore
|
1442 | 1435 | val = win.fp_easings[getOptions().easing](currentTime, start, change, duration);
|
1443 | 1436 | }
|
1444 | 1437 |
|
1445 |
| - setScrolling(element, val); |
| 1438 | + if (currentTime <= duration) { |
| 1439 | + setScrolling(element, val); |
| 1440 | + } |
1446 | 1441 |
|
1447 | 1442 | if (currentTime < duration) {
|
1448 |
| - clearTimeout(g_animateScrollId); |
1449 |
| - g_animateScrollId = setTimeout(animateScroll, increment); |
| 1443 | + window.requestAnimationFrame(animateScroll); |
1450 | 1444 | } else if (typeof callback !== 'undefined' && !isCallbackFired) {
|
1451 | 1445 | callback();
|
1452 | 1446 | isCallbackFired = true;
|
|
1457 | 1451 | }
|
1458 | 1452 | };
|
1459 | 1453 |
|
1460 |
| - animateScroll(); |
| 1454 | + window.requestAnimationFrame(animateScroll); |
1461 | 1455 | }
|
1462 | 1456 | /**
|
1463 | 1457 | * Getting the position of the element to scroll when using jQuery animations
|
|
2657 | 2651 | var scrollableItem = scrollOverflowHandler.scrollable(el);
|
2658 | 2652 | var positionY = scrollableItem.scrollTop;
|
2659 | 2653 | 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); |
2661 | 2655 | var isScrolled = isTopReached || isBottomReached;
|
2662 | 2656 |
|
2663 | 2657 | if (!isScrolled) {
|
|
2833 | 2827 | FP.render = onContentChange;
|
2834 | 2828 |
|
2835 | 2829 | function bindEvents$9() {
|
2836 |
| - if (getOptions().observer && "MutationObserver" in window) { |
| 2830 | + if (getOptions().observer && "MutationObserver" in window && $(WRAPPER_SEL)[0]) { |
2837 | 2831 | g_wrapperObserver = createObserver($(WRAPPER_SEL)[0], onContentChange, g_wrapperObserveConfig);
|
2838 | 2832 | }
|
2839 | 2833 |
|
|
2905 | 2899 | });
|
2906 | 2900 | }
|
2907 | 2901 |
|
2908 |
| - if (getOptions().observer && g_wrapperObserver) { |
| 2902 | + if (getOptions().observer && g_wrapperObserver && $(WRAPPER_SEL)[0]) { |
2909 | 2903 | g_wrapperObserver.observe($(WRAPPER_SEL)[0], g_wrapperObserveConfig);
|
2910 | 2904 | }
|
2911 | 2905 | }
|
|
3648 | 3642 | var touchEndX = 0;
|
3649 | 3643 | var MSPointer = getMSPointer();
|
3650 | 3644 | 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 |
3653 | 3647 | };
|
3654 | 3648 | /**
|
3655 | 3649 | * Adds the possibility to auto scroll through sections on touch devices.
|
3656 | 3650 | */
|
3657 | 3651 |
|
3658 | 3652 | function addTouchHandler() {
|
| 3653 | + if (!events.touchmove) { |
| 3654 | + return; |
| 3655 | + } |
| 3656 | + |
3659 | 3657 | if (isTouchDevice || isTouch) {
|
3660 | 3658 | if (getOptions().autoScrolling) {
|
3661 | 3659 | $body.removeEventListener(events.touchmove, preventBouncing, {
|
|
3682 | 3680 | */
|
3683 | 3681 |
|
3684 | 3682 | function removeTouchHandler() {
|
| 3683 | + if (!events.touchmove) { |
| 3684 | + return; |
| 3685 | + } |
| 3686 | + |
3685 | 3687 | if (isTouchDevice || isTouch) {
|
3686 | 3688 | // normalScrollElements requires it off #2691
|
3687 | 3689 | if (getOptions().autoScrolling) {
|
|
4548 | 4550 | var windowsWidth = getWindowWidth();
|
4549 | 4551 | var g_resizeId;
|
4550 | 4552 | var g_isConsecutiveResize = false;
|
| 4553 | + var g_resizeMobileHandlerId; |
4551 | 4554 | FP.reBuild = reBuild;
|
4552 | 4555 | EventEmitter.on('bindEvents', bindEvents$6);
|
4553 | 4556 |
|
|
4559 | 4562 |
|
4560 | 4563 | function onDestroy$3() {
|
4561 | 4564 | clearTimeout(g_resizeId);
|
| 4565 | + clearTimeout(g_resizeMobileHandlerId); |
4562 | 4566 | windowRemoveEvent('resize', resizeHandler);
|
4563 | 4567 | }
|
4564 | 4568 | /*
|
|
4573 | 4577 | }
|
4574 | 4578 | }
|
4575 | 4579 |
|
| 4580 | + fitToActiveSection(); |
4576 | 4581 | g_isConsecutiveResize = true; //in order to call the functions only when the resize is finished
|
4577 | 4582 | //http://stackoverflow.com/questions/4298612/jquery-how-to-call-resize-event-only-once-its-finished-resizing
|
4578 | 4583 |
|
|
4586 | 4591 | g_isConsecutiveResize = false; // }
|
4587 | 4592 | }, 400);
|
4588 | 4593 | }
|
| 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 | + } |
4589 | 4614 | /**
|
4590 | 4615 | * When resizing the site, we adjust the heights of the sections, slimScroll...
|
4591 | 4616 | */
|
|
5155 | 5180 | });
|
5156 | 5181 | });
|
5157 | 5182 | var t = ["-"];
|
5158 |
| - var n = "2022-4-9".split("-"), |
| 5183 | + var n = "2022-4-20".split("-"), |
5159 | 5184 | e = new Date(n[0], n[1], n[2]),
|
5160 | 5185 | i = ["se", "licen", "-", "v3", "l", "gp"];
|
5161 | 5186 |
|
|
5571 | 5596 | }; //public functions
|
5572 | 5597 |
|
5573 | 5598 |
|
5574 |
| - FP.version = '4.0.7'; |
| 5599 | + FP.version = '4.0.8'; |
5575 | 5600 | FP.test = Object.assign(FP.test, {
|
5576 | 5601 | top: '0px',
|
5577 | 5602 | translate3d: 'translate3d(0px, 0px, 0px)',
|
|
0 commit comments