pagePiling.js icon indicating copy to clipboard operation
pagePiling.js copied to clipboard

Missing empty section check

Open gzalo opened this issue 6 years ago • 1 comments

Hi. There is a bug in this line:

If any other anchor changes the hash of the URL to one name that doesn't exist in the sectionAnchor array, the page will scroll to the first section!

https://github.com/alvarotrigo/pagePiling.js/blob/4f3de9c79948c254f38610bd321ca42e258782e9/jquery.pagepiling.js#L471

I think that a check like this is missing:

if(section.length>0){
 scrollPage(section);
}

Thanks, Gonzalo

gzalo avatar Nov 25 '18 21:11 gzalo

Thanks for reporting it! Please feel free to provide a pull request and become a contributor to the project!

alvarotrigo avatar Nov 25 '18 22:11 alvarotrigo