jparallax
jparallax copied to clipboard
Feature #90: Adding touch compatibility (new event listeners).
Currently a work in progress; still needs a proper initialization on load. Possibly as a configuration parameter, since naturally you cannot hover over anything with a touch device, but you can swipe. Only works currently if you tap first on the viewport and then swipe around. The touch emulates a mouseenter
event. The idea then would probably be to trigger a mouseenter
event on any of the touch events in case it hasn't already been triggered.
Currently how I'm doing this outside of this library is with Modernizr, simply looking for a touch
class and then initializing it on page load:
if ($('html').hasClass('touch')) viewport.mouseenter();
Again a better solution here would be to wait first for some interaction, since as a plugin, it needs to be concerned only about it self and not initialize due to changes in global state (i.e. page load).