peachananr / purejs-onepage-scroll

The javascript version of the infamous jQuery One Page Scroll without relying on jQuery.
http://peachananr.github.io/purejs-onepage-scroll/demo/purejs_onepage_scroll_demo.html
GNU General Public License v2.0
768 stars 180 forks source link

moveTo is not working #14

Open vem opened 9 years ago

vem commented 9 years ago

tips: Cannot read property 'className' of null

yeahdino commented 9 years ago

Solution provided by Reddit user IAMAnuttysquirrel:

Bad luck, the vanilla JS version of the library has a bug too. But we can work around it. moveTo() tries to remove .active from the .onepage-pagination li a jquery.onepage-scroll.js:473 But since you initialised onePageScroll({pagination: false}) it actually hasn't created the pagination dom elements. Thus, trying to change the className of a non-existing element... Uncaught TypeError. The onePageScroll developer has forgotten to surround this piece of code with:

if(settings.pagination == true) { _removeClass(.....); _addClass(.....); }