Open wwwebman opened 8 years ago
use .get()
otherwise you initialize a skrollr instance on mobile devices instead of destroying one.
if (viewportWidth >= mobile) {
skrollr.init({
forceHeight: false,
smoothScrolling: true
});
} else if (typeof skrollr.get() !== 'undefined') {
skrollr.get().destroy();
}
init of scrollr make some bug: Make init and destroy in simple way:
if (viewportWidth >= mobile) { skrollr.init({ forceHeight: false, smoothScrolling: true }); }else { skrollr.init().destroy(); }
But: When i scroll page bottom sometimes happen returning or jumping top. When i dont destroy, but just init:
if (viewportWidth >= mobile) { skrollr.init({ forceHeight: false, smoothScrolling: true });
Everithing is ok. But onresize i need destroy/init on other devices. My question: can i make destroy without init, I meen:
skrollr.init().destroy();
And it must be based on checking viewport width, but not device type.
Thanks a lot.