wagerfield/parallax

Anyway to disable parallax only for Mobile Devices.

Reubzz opened this issue · 3 comments

Reubzz commented

I wanna basically have the parallax feature on Desktop only and not have it on Mobile devices. How do I go about that?

before intializing the scene you can just check whether the user is on a mobile device or not and conditionally run the Parallax contructor.

Reubzz commented

Yeah I figured that out and implemented this

Just for future reference (and in case you don't want to use screen width), this is as of writing the code the library uses to check for mobile devices:

this.desktop = !navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|BB10|mobi|tablet|opera mini|nexus 7)/i)
this.motionSupport = !!window.DeviceMotionEvent && !this.desktop

I know, I know, regex useragent matching...