d4nyll / smartscroll

jQuery plugin for scrolljacking and auto-hashing
https://d4nyll.github.io/smartscroll/
MIT License
257 stars 45 forks source link

Scrolling by sections is not working on touch devices #21

Closed tribou closed 8 years ago

tribou commented 8 years ago

Is this plugin supposed to work on an iPad or any touchscreen device? The examples weren't working on any of my touchscreen devices.

d4nyll commented 8 years ago

@tribou Touch support was implemented with commit 99b9df7cf9425fa823fa48e6326d7081dc9d1993. This change is not yet reflected in the demo because I am currently redoing the entire demo (mostly to improve the look)

If you use the latest version (2.4.0), it should work on touchscreen devices.

Thanks for checking it out, if you have an issues, feel free to message me back!

rbijkercom commented 5 years ago

Hi @d4nyll ,

Great plugin! I have copied the smartscroll.min.js from the master branche and added it to my site http://vagari.rbijker.com/

It works fine on desktop but it doesnt seem to work on mobile (I tested it on iPhone Safari and Android Chrome). I also included lethargy.min.js.

Should this last version work on mobile? Am I missing something?

Thanks!

d4nyll commented 5 years ago

@rbijkercom Can you post your configurations?

Also, can you make sure the following options are enabled:

rbijkercom commented 5 years ago

Hi @d4nyll

This is my configuration:

 var options = {
    mode: "set",
    autoHash: false,
    sectionScroll: true,
    initialScroll: true,
    keepHistory: false,
    sectionWrapperSelector: ".scroll-wrapper",
    sectionClass: "scroll-section",
    animationSpeed: 1200,
    headerHash: "header",
    breakpoint: null,
    eventEmitter: null,
    dynamicHeight: true
  };
  $.smartscroll(options);
rbijkercom commented 5 years ago

ps. when I check your demo pages on mobile it doesnt work either. 🤔 Should they be working?

Thanks for your help!

d4nyll commented 5 years ago

Just checked my code again. Right now, for mobile, smartscroll will emit events to say "this is a swipe down action" but it won't actually scroll. This was because 1) I don't have time to refactor the code to update 2) I really believe that it is very bad for user experience to hijack the viewer's scroll, especially on mobile.

If you want to use smartscroll, fork the repo and change this block in a similar way to options.bindKeyboard. You can copy and paste the most of the block and change just the case 38: and case 40: conditionals.

rbijkercom commented 5 years ago

Thank you for the hints. I got it to work, but like you said, it's not optimal for mobile. It stutters a bit and it doesn't always scrolls to the correct section. Thanks anyway and keep up the good work!

d4nyll commented 5 years ago

@rbijkercom Thanks! All the best with your project!