|
1 | 1 | /*!
|
2 |
| -* fullPage 4.0.6 |
| 2 | +* fullPage 4.0.7 |
3 | 3 | * https://github.com/alvarotrigo/fullPage.js
|
4 | 4 | *
|
5 | 5 | * @license GPLv3 for open source use only
|
|
1419 | 1419 | var change = to - start;
|
1420 | 1420 | var currentTime = 0;
|
1421 | 1421 | var increment = 20;
|
| 1422 | + var isCallbackFired = false; |
1422 | 1423 | setState({
|
1423 | 1424 | activeAnimation: true
|
1424 |
| - }); |
1425 |
| - var isCallbackFired = false; // Making sure we can trigger a scroll animation |
| 1425 | + }); // Making sure we can trigger a scroll animation |
1426 | 1426 | // when css scroll snap is active. Temporally disabling it.
|
1427 | 1427 |
|
1428 | 1428 | if (element === doc.body) {
|
|
2605 | 2605 | this.focusedElem.blur();
|
2606 | 2606 | }
|
2607 | 2607 |
|
2608 |
| - if ($(OVERFLOW_SEL, getState().activeSection.item)[0]) { |
| 2608 | + if ($(OVERFLOW_SEL + ACTIVE_SEL, getState().activeSection.item)[0]) { |
2609 | 2609 | this.focusedElem = $(OVERFLOW_SEL, getState().activeSection.item)[0];
|
2610 | 2610 | this.focusedElem.focus();
|
2611 | 2611 | }
|
|
3517 | 3517 |
|
3518 | 3518 | function afterSectionLoads(v) {
|
3519 | 3519 | 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 | + } |
3523 | 3526 | }
|
3524 | 3527 |
|
3525 | 3528 | setState({
|
|
3707 | 3710 | function touchMoveHandler(e) {
|
3708 | 3711 | var activeSection = closest(e.target, SECTION_SEL) || getState().activeSection.item;
|
3709 | 3712 | 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; |
3716 | 3713 |
|
3717 | 3714 | if (isReallyTouch(e)) {
|
3718 | 3715 | setState({
|
|
3730 | 3727 | var touchEvents = getEventsPage(e);
|
3731 | 3728 | touchEndY = touchEvents.y;
|
3732 | 3729 | 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; |
3733 | 3736 | setState({
|
3734 | 3737 | touchDirection: direction
|
3735 | 3738 | }); //if movement in the X axys is greater than in the Y and the currect section has slides...
|
|
3989 | 3992 |
|
3990 | 3993 | docAddEvent('keydown', keydownHandler); // for fitToSection:true
|
3991 | 3994 |
|
3992 |
| - $body.addEventListener('keydown', cancelDirectionKeyEvents); //to prevent scrolling while zooming |
| 3995 | + $body.addEventListener('keydown', onBodyClick); //to prevent scrolling while zooming |
3993 | 3996 |
|
3994 | 3997 | docAddEvent('keyup', keyUpHandler);
|
3995 | 3998 | EventEmitter.on('onDestroy', onDestroy$5);
|
|
3999 | 4002 | clearTimeout(g_keydownId);
|
4000 | 4003 | docRemoveEvent('keydown', keydownHandler);
|
4001 | 4004 | 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') == ''; |
4002 | 4010 | } //Sliding with arrow keys, both, vertical and horizontal
|
4003 | 4011 |
|
4004 | 4012 |
|
4005 | 4013 | function keydownHandler(e) {
|
4006 | 4014 | clearTimeout(g_keydownId);
|
4007 |
| - var activeElement = doc.activeElement; |
4008 | 4015 | var keyCode = e.keyCode;
|
4009 | 4016 | var isPressingHorizontalArrows = [37, 39].indexOf(keyCode) > -1;
|
4010 | 4017 | var canScrollWithKeyboard = getOptions().autoScrolling || isPressingHorizontalArrows; //tab?
|
4011 | 4018 |
|
4012 | 4019 | if (keyCode === 9) {
|
4013 | 4020 | 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) { |
4015 | 4022 | g_controlPressed = e.ctrlKey;
|
4016 | 4023 | g_keydownId = setTimeout(function () {
|
4017 | 4024 | onkeydown(e);
|
|
4202 | 4209 | }
|
4203 | 4210 |
|
4204 | 4211 | 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 |
4205 | 4218 | var keyControls = [40, 38, 32, 33, 34];
|
4206 | 4219 | return keyControls.indexOf(e.keyCode) > -1 && !state.isBeyondFullpage;
|
| 4220 | + } |
| 4221 | + |
| 4222 | + function onBodyClick(e) { |
| 4223 | + if (!isInsideInput()) { |
| 4224 | + cancelDirectionKeyEvents(e); |
| 4225 | + } |
4207 | 4226 | } //preventing the scroll with arrow keys & spacebar & Page Up & Down keys
|
4208 | 4227 |
|
4209 | 4228 |
|
|
4953 | 4972 |
|
4954 | 4973 | setPageStatus(slideIndex, slideAnchorLink, anchorLink);
|
4955 | 4974 | updateState();
|
4956 |
| - } //small timeout in order to avoid entering in hashChange event when scrolling is not finished yet |
4957 |
| - |
| 4975 | + } |
4958 | 4976 |
|
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 | + } |
4965 | 4996 | }
|
4966 | 4997 | }
|
4967 | 4998 | }
|
|
5124 | 5155 | });
|
5125 | 5156 | });
|
5126 | 5157 | var t = ["-"];
|
5127 |
| - var n = "2022-3-19".split("-"), |
| 5158 | + var n = "2022-4-9".split("-"), |
5128 | 5159 | e = new Date(n[0], n[1], n[2]),
|
5129 | 5160 | i = ["se", "licen", "-", "v3", "l", "gp"];
|
5130 | 5161 |
|
|
5133 | 5164 | }
|
5134 | 5165 |
|
5135 | 5166 | function o(t) {
|
5136 |
| - return isNaN(t) ? t.charCodeAt(0) - 72 : t; |
| 5167 | + return t ? isNaN(t) ? t.charCodeAt(0) - 72 : t : ""; |
5137 | 5168 | }
|
5138 | 5169 |
|
5139 | 5170 | function a(t) {
|
|
5540 | 5571 | }; //public functions
|
5541 | 5572 |
|
5542 | 5573 |
|
5543 |
| - FP.version = '4.0.6'; |
| 5574 | + FP.version = '4.0.7'; |
5544 | 5575 | FP.test = Object.assign(FP.test, {
|
5545 | 5576 | top: '0px',
|
5546 | 5577 | translate3d: 'translate3d(0px, 0px, 0px)',
|
|
0 commit comments