|
1 | 1 | /*!
|
2 |
| - * fullPage 2.9.3 |
| 2 | + * fullPage 2.9.4 |
3 | 3 | * https://github.com/alvarotrigo/fullPage.js
|
4 | 4 | * @license MIT licensed
|
5 | 5 | *
|
|
206 | 206 | var canScroll = true;
|
207 | 207 | var scrollings = [];
|
208 | 208 | var controlPressed;
|
| 209 | + var startingSection; |
209 | 210 | var isScrollAllowed = {};
|
210 | 211 | isScrollAllowed.m = { 'up':true, 'down':true, 'left':true, 'right':true };
|
211 | 212 | isScrollAllowed.k = $.extend(true,{}, isScrollAllowed.m);
|
|
552 | 553 | options.scrollBar = options.scrollBar || options.hybrid;
|
553 | 554 |
|
554 | 555 | setOptionsFromDOM();
|
555 |
| - |
556 | 556 | prepareDom();
|
557 | 557 | setAllowScrolling(true);
|
558 |
| - |
559 | 558 | setAutoScrolling(options.autoScrolling, 'internal');
|
560 |
| - |
561 |
| - //the starting point is a slide? |
562 |
| - var activeSlide = $(SECTION_ACTIVE_SEL).find(SLIDE_ACTIVE_SEL); |
563 |
| - |
564 |
| - //the active section isn't the first one? Is not the first slide of the first section? Then we load that section/slide by default. |
565 |
| - if( activeSlide.length && ($(SECTION_ACTIVE_SEL).index(SECTION_SEL) !== 0 || ($(SECTION_ACTIVE_SEL).index(SECTION_SEL) === 0 && activeSlide.index() !== 0))){ |
566 |
| - silentLandscapeScroll(activeSlide); |
567 |
| - } |
568 |
| - |
569 | 559 | responsive();
|
570 | 560 |
|
571 | 561 | //setting the class for the body element
|
|
757 | 747 | if(!index && $(SECTION_ACTIVE_SEL).length === 0) {
|
758 | 748 | section.addClass(ACTIVE);
|
759 | 749 | }
|
| 750 | + startingSection = $(SECTION_ACTIVE_SEL); |
760 | 751 |
|
761 | 752 | section.css('height', windowsHeight + 'px');
|
762 | 753 |
|
|
916 | 907 | lazyLoad(section);
|
917 | 908 | playMedia(section);
|
918 | 909 | options.scrollOverflowHandler.afterLoad();
|
| 910 | + |
| 911 | + if(isDestinyTheStartingSection()){ |
| 912 | + $.isFunction( options.afterLoad ) && options.afterLoad.call(section, section.data('anchor'), (section.index(SECTION_SEL) + 1)); |
| 913 | + } |
919 | 914 |
|
920 |
| - $.isFunction( options.afterLoad ) && options.afterLoad.call(section, section.data('anchor'), (section.index(SECTION_SEL) + 1)); |
921 | 915 | $.isFunction( options.afterRender ) && options.afterRender.call(container);
|
922 | 916 | }
|
923 | 917 |
|
| 918 | + function isDestinyTheStartingSection(){ |
| 919 | + var anchors = window.location.hash.replace('#', '').split('/'); |
| 920 | + var destinationSection = getSectionByAnchor(decodeURIComponent(anchors[0])); |
| 921 | + |
| 922 | + return !destinationSection.length || destinationSection.length && destinationSection.index() === startingSection.index(); |
| 923 | + } |
| 924 | + |
924 | 925 |
|
925 | 926 | var isScrolling = false;
|
926 | 927 | var lastScroll = 0;
|
|
2278 | 2279 | * Gets a section by its anchor / index
|
2279 | 2280 | */
|
2280 | 2281 | function getSectionByAnchor(sectionAnchor){
|
| 2282 | + if(!sectionAnchor) return []; |
| 2283 | + |
2281 | 2284 | //section
|
2282 | 2285 | var section = container.find(SECTION_SEL + '[data-anchor="'+sectionAnchor+'"]');
|
2283 | 2286 | if(!section.length){
|
2284 |
| - section = $(SECTION_SEL).eq( (sectionAnchor -1) ); |
| 2287 | + section = $(SECTION_SEL).eq( sectionAnchor -1); |
2285 | 2288 | }
|
2286 | 2289 |
|
2287 | 2290 | return section;
|
|
0 commit comments