Fullpage.js: Back history to 1st horizontal slide

Created on 12 May 2017  路  2Comments  路  Source: alvarotrigo/fullPage.js

Description

When i go back from URL like #section/slide2 to #section/slide1 it work perfect, and function scrollPageAndSlide work good. But when i go back to #section it not go to slide 0.

When i debug, i see this code

function hashChangeHandler(){
            if(!isScrolling && !options.lockAnchors){
                var value =  window.location.hash.replace('#', '').split('/');
                var sectionAnchor = decodeURIComponent(value[0]);
                var slideAnchor = decodeURIComponent(value[1]);
....
                        scrollPageAndSlide(sectionAnchor, slideAnchor);
....
}

decodeURIComponent return string 'undefined' when not set.

function scrollPageAndSlide(destiny, slide){
            var section = getSectionByAnchor(destiny);

            //do nothing if there's no section with the given anchor name
            if(!section.length) return;

            //default slide
            if (typeof slide === 'undefined') {
                slide = 0; **//not comes here**
            }
....
}

I assume that is not correct to compare a string 'undefined' with the type of undefined ?

Versions

[ * fullPage 2.9.4, Firefox 53.0.2 and posible any others]

bug fixed on dev

Most helpful comment

Thanks for reporting it!
That's a bug. I'll see what I can do for the next release!

All 2 comments

Thanks for reporting it!
That's a bug. I'll see what I can do for the next release!

Fixed on the dev branch. Will get merged in the next release, fullPage.js 2.9.6.

Was this page helpful?
0 / 5 - 0 ratings