|
1 | 1 | /*!
|
2 |
| - * fullPage 2.8.8 |
| 2 | + * fullPage 2.8.9 |
3 | 3 | * https://github.com/alvarotrigo/fullPage.js
|
4 | 4 | * @license MIT licensed
|
5 | 5 | *
|
|
138 | 138 | continuousHorizontal: false,
|
139 | 139 | scrollHorizontally: false,
|
140 | 140 | interlockedSlides: false,
|
| 141 | + dragAndMove: false, |
| 142 | + offsetSections: false, |
141 | 143 | resetSliders: false,
|
142 | 144 | fadingEffect: false,
|
143 | 145 | normalScrollElements: null,
|
|
314 | 316 | }
|
315 | 317 |
|
316 | 318 | /**
|
317 |
| - * Adds or remove the possiblity of scrolling through sections by using the mouse wheel/trackpad or touch gestures. |
| 319 | + * Adds or remove the possibility of scrolling through sections by using the mouse wheel/trackpad or touch gestures. |
318 | 320 | * Optionally a second parameter can be used to specify the direction for which the action will be applied.
|
319 | 321 | *
|
320 | 322 | * @param directions string containing the direction or directions separated by comma.
|
|
337 | 339 | }
|
338 | 340 |
|
339 | 341 | /**
|
340 |
| - * Adds or remove the possiblity of scrolling through sections by using the keyboard arrow keys |
| 342 | + * Adds or remove the possibility of scrolling through sections by using the keyboard arrow keys |
341 | 343 | */
|
342 | 344 | function setKeyboardScrolling(value, directions){
|
343 | 345 | if(typeof directions !== 'undefined'){
|
|
501 | 503 | }
|
502 | 504 | }
|
503 | 505 |
|
504 |
| - function getFullpageData(){ |
505 |
| - return { |
506 |
| - options: options, |
507 |
| - internals: { |
508 |
| - getXmovement: getXmovement, |
509 |
| - removeAnimation: removeAnimation, |
510 |
| - getTransforms: getTransforms, |
511 |
| - lazyLoad: lazyLoad, |
512 |
| - addAnimation: addAnimation, |
513 |
| - performHorizontalMove: performHorizontalMove, |
514 |
| - silentLandscapeScroll: silentLandscapeScroll, |
515 |
| - keepSlidesPosition: keepSlidesPosition, |
516 |
| - silentScroll: silentScroll, |
517 |
| - styleSlides: styleSlides |
518 |
| - } |
519 |
| - }; |
520 |
| - } |
521 |
| - |
522 | 506 | if($(this).length){
|
523 | 507 | //public functions
|
524 | 508 | FP.setAutoScrolling = setAutoScrolling;
|
|
537 | 521 | FP.moveSlideLeft = moveSlideLeft;
|
538 | 522 | FP.reBuild = reBuild;
|
539 | 523 | FP.setResponsive = setResponsive;
|
540 |
| - FP.getFullpageData = getFullpageData; |
541 | 524 | FP.destroy = destroy;
|
542 | 525 |
|
543 | 526 | init();
|
|
588 | 571 | //(a way to detect back history button as we play with the hashes on the URL)
|
589 | 572 | .on('hashchange', hashChangeHandler)
|
590 | 573 |
|
591 |
| - //when opening a new tab (ctrl + t), `control` won't be pressed when comming back. |
| 574 | + //when opening a new tab (ctrl + t), `control` won't be pressed when coming back. |
592 | 575 | .blur(blurHandler)
|
593 | 576 |
|
594 | 577 | //when resizing the site, we adjust the heights of the sections, slimScroll...
|
|
640 | 623 | }).get();
|
641 | 624 | }
|
642 | 625 |
|
643 |
| - //no tooltipos option? Checking for them in the DOM attributes |
| 626 | + //no tooltips option? Checking for them in the DOM attributes |
644 | 627 | if(!options.navigationTooltips.length){
|
645 | 628 | options.navigationTooltips = sections.filter('[data-tooltip]').map(function(){
|
646 | 629 | return $(this).data('tooltip').toString();
|
|
649 | 632 | }
|
650 | 633 |
|
651 | 634 | /**
|
652 |
| - * Works over the DOM structure to set it up for the current fullpage optionss. |
| 635 | + * Works over the DOM structure to set it up for the current fullpage options. |
653 | 636 | */
|
654 | 637 | function prepareDom(){
|
655 | 638 | container.css({
|
|
664 | 647 | //due to https://github.com/alvarotrigo/fullPage.js/issues/1502
|
665 | 648 | windowsHeight = $window.height();
|
666 | 649 |
|
667 |
| - container.removeClass(DESTROYED); //in case it was destroyed before initilizing it again |
| 650 | + container.removeClass(DESTROYED); //in case it was destroyed before initializing it again |
668 | 651 |
|
669 | 652 | addInternalSelectors();
|
670 | 653 |
|
|
917 | 900 | }
|
918 | 901 | lazyLoad(section);
|
919 | 902 | playMedia(section);
|
| 903 | + options.scrollOverflowHandler.afterLoad(); |
920 | 904 |
|
921 | 905 | $.isFunction( options.afterLoad ) && options.afterLoad.call(section, section.data('anchor'), (section.index(SECTION_SEL) + 1));
|
922 | 906 | $.isFunction( options.afterRender ) && options.afterRender.call(container);
|
|
1090 | 1074 | */
|
1091 | 1075 | function preventBouncing(event){
|
1092 | 1076 | var e = event.originalEvent;
|
1093 |
| - if(options.autoScrolling && isReallyTouch(e)){ |
| 1077 | + if(!checkParentForNormalScrollElement(event.target) && options.autoScrolling && isReallyTouch(e)){ |
1094 | 1078 | //preventing the easing on iOS devices
|
1095 | 1079 | event.preventDefault();
|
1096 | 1080 | }
|
|
1120 | 1104 | }
|
1121 | 1105 |
|
1122 | 1106 | var scrollable = options.scrollOverflowHandler.scrollable(activeSection);
|
| 1107 | + var touchEvents = getEventsPage(e); |
1123 | 1108 |
|
1124 |
| - if (canScroll && !slideMoving) { //if theres any # |
1125 |
| - var touchEvents = getEventsPage(e); |
1126 |
| - |
1127 |
| - touchEndY = touchEvents.y; |
1128 |
| - touchEndX = touchEvents.x; |
1129 |
| - |
1130 |
| - //if movement in the X axys is greater than in the Y and the currect section has slides... |
1131 |
| - if (activeSection.find(SLIDES_WRAPPER_SEL).length && Math.abs(touchStartX - touchEndX) > (Math.abs(touchStartY - touchEndY))) { |
1132 |
| - |
1133 |
| - //is the movement greater than the minimum resistance to scroll? |
1134 |
| - if (Math.abs(touchStartX - touchEndX) > ($window.outerWidth() / 100 * options.touchSensitivity)) { |
1135 |
| - if (touchStartX > touchEndX) { |
1136 |
| - if(isScrollAllowed.m.right){ |
1137 |
| - moveSlideRight(activeSection); //next |
1138 |
| - } |
1139 |
| - } else { |
1140 |
| - if(isScrollAllowed.m.left){ |
1141 |
| - moveSlideLeft(activeSection); //prev |
1142 |
| - } |
| 1109 | + touchEndY = touchEvents.y; |
| 1110 | + touchEndX = touchEvents.x; |
| 1111 | + |
| 1112 | + //if movement in the X axys is greater than in the Y and the currect section has slides... |
| 1113 | + if (activeSection.find(SLIDES_WRAPPER_SEL).length && Math.abs(touchStartX - touchEndX) > (Math.abs(touchStartY - touchEndY))) { |
| 1114 | + |
| 1115 | + //is the movement greater than the minimum resistance to scroll? |
| 1116 | + if (!slideMoving && Math.abs(touchStartX - touchEndX) > ($window.outerWidth() / 100 * options.touchSensitivity)) { |
| 1117 | + if (touchStartX > touchEndX) { |
| 1118 | + if(isScrollAllowed.m.right){ |
| 1119 | + moveSlideRight(activeSection); //next |
| 1120 | + } |
| 1121 | + } else { |
| 1122 | + if(isScrollAllowed.m.left){ |
| 1123 | + moveSlideLeft(activeSection); //prev |
1143 | 1124 | }
|
1144 | 1125 | }
|
1145 | 1126 | }
|
| 1127 | + } |
1146 | 1128 |
|
1147 |
| - //vertical scrolling (only when autoScrolling is enabled) |
1148 |
| - else if(options.autoScrolling){ |
| 1129 | + //vertical scrolling (only when autoScrolling is enabled) |
| 1130 | + else if(options.autoScrolling && canScroll){ |
1149 | 1131 |
|
1150 |
| - //is the movement greater than the minimum resistance to scroll? |
1151 |
| - if (Math.abs(touchStartY - touchEndY) > ($window.height() / 100 * options.touchSensitivity)) { |
1152 |
| - if (touchStartY > touchEndY) { |
1153 |
| - scrolling('down', scrollable); |
1154 |
| - } else if (touchEndY > touchStartY) { |
1155 |
| - scrolling('up', scrollable); |
1156 |
| - } |
| 1132 | + //is the movement greater than the minimum resistance to scroll? |
| 1133 | + if (Math.abs(touchStartY - touchEndY) > ($window.height() / 100 * options.touchSensitivity)) { |
| 1134 | + if (touchStartY > touchEndY) { |
| 1135 | + scrolling('down', scrollable); |
| 1136 | + } else if (touchEndY > touchStartY) { |
| 1137 | + scrolling('up', scrollable); |
1157 | 1138 | }
|
1158 | 1139 | }
|
1159 | 1140 | }
|
1160 | 1141 | }
|
1161 |
| - |
1162 | 1142 | }
|
1163 | 1143 |
|
1164 | 1144 | /**
|
|
1593 | 1573 | $.isFunction(options.afterLoad) && !v.localIsResizing && options.afterLoad.call(v.element, v.anchorLink, (v.sectionIndex + 1));
|
1594 | 1574 | options.scrollOverflowHandler.afterLoad();
|
1595 | 1575 |
|
1596 |
| - playMedia(v.element); |
| 1576 | + if(!v.localIsResizing){ |
| 1577 | + playMedia(v.element); |
| 1578 | + } |
| 1579 | + |
1597 | 1580 | v.element.addClass(COMPLETELY).siblings().removeClass(COMPLETELY);
|
1598 | 1581 |
|
1599 | 1582 | canScroll = true;
|
|
1812 | 1795 | }
|
1813 | 1796 | }
|
1814 | 1797 |
|
1815 |
| - //when opening a new tab (ctrl + t), `control` won't be pressed when comming back. |
| 1798 | + //when opening a new tab (ctrl + t), `control` won't be pressed when coming back. |
1816 | 1799 | function blurHandler(){
|
1817 | 1800 | isWindowFocused = false;
|
1818 | 1801 | controlPressed = false;
|
|
1994 | 1977 | //needs to be inside the condition to prevent problems with continuousVertical and scrollHorizontally
|
1995 | 1978 | //and to prevent double scroll right after a windows resize
|
1996 | 1979 | canScroll = true;
|
1997 |
| - } |
1998 | 1980 |
|
1999 |
| - playMedia(v.destiny); |
| 1981 | + playMedia(v.destiny); |
| 1982 | + } |
2000 | 1983 |
|
2001 | 1984 | //letting them slide again
|
2002 | 1985 | slideMoving = false;
|
|
2649 | 2632 | // that's why we round it to 0.
|
2650 | 2633 | var roundedTop = Math.round(top);
|
2651 | 2634 |
|
2652 |
| - if(options.scrollBar){ |
| 2635 | + if(options.scrollBar || !options.autoScrolling){ |
2653 | 2636 | container.scrollTop(roundedTop);
|
2654 | 2637 | }
|
2655 | 2638 | else if (options.css3) {
|
|
2824 | 2807 | * Displays warnings
|
2825 | 2808 | */
|
2826 | 2809 | function displayWarnings(){
|
2827 |
| - var extensions = ['fadingEffect', 'continuousHorizontal', 'scrollHorizontally', 'interlockedSlides', 'resetSliders', 'responsiveSlides']; |
| 2810 | + var extensions = ['fadingEffect', 'continuousHorizontal', 'scrollHorizontally', 'interlockedSlides', 'resetSliders', 'responsiveSlides', 'offsetSections', 'dragAndMove']; |
2828 | 2811 | if($('html').hasClass(ENABLED)){
|
2829 | 2812 | showError('error', 'Fullpage.js can only be initialized once and you are doing it multiple times!');
|
2830 | 2813 | return;
|
|
2841 | 2824 | showError('warn', 'Option `scrollBar` is mutually exclusive with `scrollOverflow`. Sections with scrollOverflow might not work well in Firefox');
|
2842 | 2825 | }
|
2843 | 2826 |
|
2844 |
| - if(options.continuousVertical && options.scrollBar){ |
| 2827 | + if(options.continuousVertical && (options.scrollBar || !options.autoScrolling)){ |
2845 | 2828 | options.continuousVertical = false;
|
2846 |
| - showError('warn', 'Option `scrollBar` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled'); |
| 2829 | + showError('warn', 'Scroll bars (`scrollBar:true` or `autoScrolling:false`) are mutually exclusive with `continuousVertical`; `continuousVertical` disabled'); |
2847 | 2830 | }
|
2848 | 2831 |
|
2849 | 2832 | //using extensions? Wrong file!
|
2850 |
| - extensions.forEach(function(extension){ |
| 2833 | + $.each(extensions, function(index, extension){ |
2851 | 2834 | //is the option set to true?
|
2852 | 2835 | if(options[extension]){
|
2853 | 2836 | showError('warn', 'fullpage.js extensions require jquery.fullpage.extensions.min.js file instead of the usual jquery.fullpage.js. Requested: '+ extension);
|
|
2918 | 2901 | refreshId: null,
|
2919 | 2902 | iScrollInstances: [],
|
2920 | 2903 |
|
| 2904 | + // Enables or disables the mouse wheel for the active section or all slides in it |
| 2905 | + toggleWheel: function(value){ |
| 2906 | + var scrollable = $(SECTION_ACTIVE_SEL).find(SCROLLABLE_SEL); |
| 2907 | + scrollable.each(function(){ |
| 2908 | + var iScrollInstance = $(this).data('iscrollInstance'); |
| 2909 | + if(typeof iScrollInstance !== 'undefined' && iScrollInstance){ |
| 2910 | + if(value){ |
| 2911 | + iScrollInstance.wheelOn(); |
| 2912 | + } |
| 2913 | + else{ |
| 2914 | + iScrollInstance.wheelOff(); |
| 2915 | + } |
| 2916 | + } |
| 2917 | + }); |
| 2918 | + }, |
| 2919 | + |
2921 | 2920 | /**
|
2922 | 2921 | * Turns off iScroll for the destination section.
|
2923 | 2922 | * When scrolling very fast on some trackpads (and Apple laptops) the inertial scrolling would
|
2924 | 2923 | * scroll the destination section/slide before the sections animations ends.
|
2925 | 2924 | */
|
2926 | 2925 | onLeave: function(){
|
2927 |
| - var scroller = $(SECTION_ACTIVE_SEL).find(SCROLLABLE_SEL).data('iscrollInstance'); |
2928 |
| - if(typeof scroller !== 'undefined' && scroller){ |
2929 |
| - scroller.wheelOff(); |
2930 |
| - } |
| 2926 | + iscrollHandler.toggleWheel(false); |
2931 | 2927 | },
|
2932 | 2928 |
|
2933 | 2929 | // Turns off iScroll for the leaving section
|
|
2937 | 2933 |
|
2938 | 2934 | // Turns on iScroll on section load
|
2939 | 2935 | afterLoad: function(){
|
2940 |
| - var scroller = $(SECTION_ACTIVE_SEL).find(SCROLLABLE_SEL).data('iscrollInstance'); |
2941 |
| - if(typeof scroller !== 'undefined' && scroller){ |
2942 |
| - scroller.wheelOn(); |
2943 |
| - } |
| 2936 | + iscrollHandler.toggleWheel(true); |
2944 | 2937 | },
|
2945 | 2938 |
|
2946 | 2939 | /**
|
|
2954 | 2947 |
|
2955 | 2948 | scrollable.height(scrollHeight);
|
2956 | 2949 | scrollable.each(function() {
|
2957 |
| - var $this = jQuery(this); |
| 2950 | + var $this = $(this); |
2958 | 2951 | var iScrollInstance = $this.data('iscrollInstance');
|
2959 | 2952 | if (iScrollInstance) {
|
2960 | 2953 | $.each(iscrollHandler.iScrollInstances, function(){
|
|
0 commit comments