|
1 | 1 | /*!
|
2 |
| -* fullPage 4.0.35 |
| 2 | +* fullPage 4.0.36 |
3 | 3 | * https://github.com/alvarotrigo/fullPage.js
|
4 | 4 | *
|
5 | 5 | * @license GPLv3 for open source use only
|
|
953 | 953 | }
|
954 | 954 | };
|
955 | 955 |
|
956 |
| - var state = { |
| 956 | + var defaultState = { |
957 | 957 | numSections: 0,
|
958 | 958 | numSlides: 0,
|
959 | 959 | slides: [],
|
|
981 | 981 | scrollY: 0,
|
982 | 982 | scrollX: 0,
|
983 | 983 | isFullpageInitDone: false
|
984 |
| - }; // @ts-ignore |
| 984 | + }; |
| 985 | + var state = Object.assign({}, defaultState); // @ts-ignore |
985 | 986 |
|
986 | 987 | win.state = state;
|
987 | 988 | function setState(props) {
|
|
993 | 994 | function getActivePanel() {
|
994 | 995 | return state.activeSection && state.activeSection.activeSlide ? state.activeSection.activeSlide : state.activeSection;
|
995 | 996 | }
|
| 997 | + function resetState() { |
| 998 | + setState(defaultState); |
| 999 | + } |
996 | 1000 |
|
997 | 1001 | var events = {
|
998 | 1002 | onAfterRenderNoAnchor: 'onAfterRenderNoAnchor',
|
|
1003 | 1007 | beforeInit: 'beforeInit',
|
1004 | 1008 | bindEvents: 'bindEvents',
|
1005 | 1009 | onDestroy: 'onDestroy',
|
| 1010 | + onDestroyAll: 'onDestroyAll', |
1006 | 1011 | contentChanged: 'contentChanged',
|
1007 | 1012 | onScrollOverflowScrolled: 'onScrollOverflowScrolled',
|
1008 | 1013 | onScrollPageAndSlide: 'onScrollPageAndSlide',
|
|
1908 | 1913 | return anchor;
|
1909 | 1914 | }
|
1910 | 1915 |
|
| 1916 | + EventEmitter.on(events.onDestroyAll, onDestroyAll$1); |
| 1917 | + |
| 1918 | + function onDestroyAll$1() { |
| 1919 | + setUrlHash(''); |
| 1920 | + } |
1911 | 1921 | /**
|
1912 | 1922 | * Sets the state of the website depending on the active section/slide.
|
1913 | 1923 | * It changes the URL hash when needed and updates the body class.
|
1914 | 1924 | */
|
1915 | 1925 |
|
| 1926 | + |
1916 | 1927 | function setPageStatus(slideIndex, slideAnchor, anchorLink) {
|
1917 | 1928 | var sectionHash = '';
|
1918 | 1929 |
|
|
1953 | 1964 | if (getOptions().recordHistory) {
|
1954 | 1965 | location.hash = url;
|
1955 | 1966 | } else {
|
1956 |
| - //Mobile Chrome doesn't work the normal way, so... lets use HTML5 for phones :) |
1957 |
| - if (isTouchDevice || isTouch) { |
1958 |
| - win.history.replaceState(undefined, undefined, '#' + url); |
1959 |
| - } else { |
1960 |
| - var baseUrl = win.location.href.split('#')[0]; |
1961 |
| - win.location.replace(baseUrl + '#' + url); |
1962 |
| - } |
| 1967 | + win.history.replaceState(undefined, undefined, '#' + url); |
1963 | 1968 | }
|
1964 | 1969 | }
|
1965 | 1970 |
|
|
2191 | 2196 | }
|
2192 | 2197 | }
|
2193 | 2198 |
|
| 2199 | + function getTmpPosition(v) { |
| 2200 | + return hasClass(getState().activeSection.item, AUTO_HEIGHT) ? getDestinationPosition(getState().activeSection.item) : getState().activeSection.item.offsetTop; |
| 2201 | + } |
| 2202 | + function getDestinationPosForInfiniteScroll(v) { |
| 2203 | + // forcing the scroll to the bottom of the fp-auto-height section when scrolling up |
| 2204 | + if (v.isMovementUp && hasClass(v.element, AUTO_HEIGHT)) { |
| 2205 | + return getDestinationPosition(v.element) - getWindowHeight() + v.element.offsetHeight; |
| 2206 | + } |
| 2207 | + |
| 2208 | + return v.element.offsetTop; |
| 2209 | + } |
| 2210 | + |
2194 | 2211 | //@ts-check
|
2195 | 2212 | /**
|
2196 | 2213 | * Adds sections before or after the current one to create the infinite effect.
|
|
2204 | 2221 |
|
2205 | 2222 | if (!v.isMovementUp) {
|
2206 | 2223 | // Move all previous sections to after the active section
|
2207 |
| - after(activeSectionItem, prevAll(activeSectionItem, SECTION_SEL).reverse()); |
| 2224 | + var prevSectionsReversed = prevAll(activeSectionItem, SECTION_SEL).reverse(); |
| 2225 | + after(activeSectionItem, prevSectionsReversed[0]); |
2208 | 2226 | } else {
|
2209 | 2227 | // Scrolling up
|
2210 | 2228 | // Move all next sections to before the active section
|
2211 | 2229 | before(activeSectionItem, nextAll(activeSectionItem, SECTION_SEL));
|
2212 | 2230 | } // Maintain the displayed position (now that we changed the element order)
|
2213 | 2231 |
|
2214 | 2232 |
|
2215 |
| - silentScroll(getState().activeSection.item.offsetTop); // Maintain the active slides visible in the viewport |
| 2233 | + silentScroll(getTmpPosition()); // Maintain the active slides visible in the viewport |
2216 | 2234 |
|
2217 | 2235 | keepSlidesPosition$1(); // save for later the elements that still need to be reordered
|
2218 | 2236 |
|
2219 | 2237 | v.wrapAroundElements = activeSectionItem; // Recalculate animation variables
|
2220 | 2238 |
|
2221 |
| - v.dtop = v.element.offsetTop; |
| 2239 | + v.dtop = getDestinationPosForInfiniteScroll(v); |
2222 | 2240 | v.yMovement = getYmovement(getState().activeSection, v.element);
|
2223 | 2241 | return v;
|
2224 | 2242 | }
|
|
2263 | 2281 | if (v.isMovementUp) {
|
2264 | 2282 | before($(SECTION_SEL)[0], v.wrapAroundElements);
|
2265 | 2283 | } else {
|
2266 |
| - after($(SECTION_SEL)[getState().sections.length - 1], v.wrapAroundElements); |
| 2284 | + after($(SECTION_SEL)[getState().sections.length - 1], prevAll(v.element, SECTION_SEL).reverse()); |
2267 | 2285 | }
|
2268 | 2286 |
|
2269 |
| - silentScroll(getState().activeSection.item.offsetTop); // Maintain the active slides visible in the viewport |
| 2287 | + silentScroll(getTmpPosition()); // Maintain the active slides visible in the viewport |
2270 | 2288 |
|
2271 | 2289 | keepSlidesPosition();
|
2272 | 2290 | setState({
|
|
2614 | 2632 | * Performs the vertical movement (by CSS3 or by jQuery)
|
2615 | 2633 | */
|
2616 | 2634 |
|
2617 |
| - |
2618 | 2635 | function performMovement(v) {
|
2619 | 2636 | setState({
|
2620 | 2637 | touchDirection: 'none',
|
|
3322 | 3339 |
|
3323 | 3340 | var g_prevActiveSectionIndex = null;
|
3324 | 3341 | var g_prevActiveSlideIndex = null;
|
| 3342 | + EventEmitter.on(events.onDestroyAll, onDestroyAll); |
| 3343 | + |
| 3344 | + function onDestroyAll() { |
| 3345 | + g_prevActiveSectionIndex = null; |
| 3346 | + g_prevActiveSlideIndex = null; |
| 3347 | + } |
3325 | 3348 | /**
|
3326 | 3349 | * Updates the state of the app.
|
3327 | 3350 | */
|
3328 | 3351 |
|
| 3352 | + |
3329 | 3353 | function updateState() {
|
3330 | 3354 | state.activeSection = null;
|
3331 | 3355 | state.sections.map(function (section) {
|
|
3404 | 3428 | var activeSectionHasSlides = state.activeSection ? state.activeSection.slides.length : false;
|
3405 | 3429 | var activeSlide = state.activeSection ? state.activeSection.activeSlide : null; // Hidding / removing the active section ?
|
3406 | 3430 |
|
3407 |
| - if (!activeSection && state.sections.length && !getState().isBeyondFullpage && g_prevActiveSectionIndex) { |
| 3431 | + if (!activeSection && state.sections.length && !getState().isBeyondFullpage && g_prevActiveSectionIndex !== null) { |
3408 | 3432 | var newActiveSection = getNewActivePanel(g_prevActiveSectionIndex, state.sections);
|
3409 | 3433 |
|
3410 | 3434 | if (newActiveSection) {
|
|
3418 | 3442 | }
|
3419 | 3443 | }
|
3420 | 3444 |
|
3421 |
| - if (activeSectionHasSlides && !activeSlide && g_prevActiveSlideIndex) { |
| 3445 | + if (activeSectionHasSlides && !activeSlide && g_prevActiveSlideIndex !== null) { |
3422 | 3446 | var newActiveSlide = getNewActivePanel(g_prevActiveSlideIndex, state.activeSection.slides);
|
3423 | 3447 |
|
3424 | 3448 | if (newActiveSlide) {
|
|
3559 | 3583 | characterData: true
|
3560 | 3584 | };
|
3561 | 3585 | EventEmitter.on(events.bindEvents, bindEvents$9);
|
| 3586 | + EventEmitter.on(events.onDestroy, unbindEvents); |
3562 | 3587 | FP["render"] = onContentChange;
|
3563 | 3588 |
|
3564 | 3589 | function bindEvents$9() {
|
|
3568 | 3593 |
|
3569 | 3594 | EventEmitter.on(events.contentChanged, onContentChange);
|
3570 | 3595 | }
|
| 3596 | + |
| 3597 | + function unbindEvents() { |
| 3598 | + if (g_wrapperObserver) { |
| 3599 | + g_wrapperObserver.disconnect(); |
| 3600 | + g_wrapperObserver = null; |
| 3601 | + } |
| 3602 | + } |
3571 | 3603 | /**
|
3572 | 3604 | * Creates a Mutation observer.
|
3573 | 3605 | */
|
|
4717 | 4749 |
|
4718 | 4750 | scrollings.push(Math.abs(value)); //preventing to scroll the site on mouse wheel when scrollbar is present
|
4719 | 4751 |
|
4720 |
| - if (getOptions().scrollBar) { |
| 4752 | + if (getOptions().scrollBar || !getOptions().scrollOverflow) { |
4721 | 4753 | preventDefault(e);
|
4722 | 4754 | } //time difference between the last scroll and the current one
|
4723 | 4755 |
|
|
5570 | 5602 | });
|
5571 | 5603 | });
|
5572 | 5604 | var t = ["-"];
|
5573 |
| - var n = "\x32\x30\x32\x35\x2d\x33\x2d\x31".split("-"), |
| 5605 | + var n = "\x32\x30\x32\x35\x2d\x35\x2d\x32".split("-"), |
5574 | 5606 | e = new Date(n[0], n[1], n[2]),
|
5575 | 5607 | r = ["se", "licen", "-", "v3", "l", "gp"];
|
5576 | 5608 |
|
|
5880 | 5912 | usedSelectors.forEach(function (item) {
|
5881 | 5913 | removeClass($('.' + item), item);
|
5882 | 5914 | });
|
| 5915 | + resetState(); |
| 5916 | + EventEmitter.emit(events.onDestroyAll); |
5883 | 5917 | }
|
5884 | 5918 |
|
5885 | 5919 | FP.destroy = destroy;
|
|
6031 | 6065 | }; //public functions
|
6032 | 6066 |
|
6033 | 6067 |
|
6034 |
| - FP.version = '4.0.35'; |
| 6068 | + FP.version = '4.0.36'; |
6035 | 6069 | FP.test = Object.assign(FP.test, {
|
6036 | 6070 | top: '0px',
|
6037 | 6071 | translate3d: 'translate3d(0px, 0px, 0px)',
|
|
0 commit comments