Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable fullpage.js on mobile (touch) devices

I'm using fullpage.js and the slimscroll.js plugin, which is required to allow scrolling in a section which has content that exceeds the height it's container section.

I've noticed that the experience is quite bad on touch devices. Whereas normally you can swipe, release and watch the page still scroll, on a slimscroll div as soon as your finger leaves the touch area, the scrolling stops.

So what I'd like to do is disable fullpage.js on mobiles and tablets, but still enable it on desktops. I checked out fullPage.js's issues and documentation but I couldn't find a simple way of doing this.

Could anyone help me out?

Thanks a lot

like image 591
patrickzdb Avatar asked Mar 17 '14 14:03

patrickzdb


1 Answers

I use this way!

var isPhoneDevice = "ontouchstart" in document.documentElement; 
$(document).ready(function() {
        if(isPhoneDevice){
            //mobile
        }
            else{
                //desktop               
                $.fn.fullpage();
            }
        });
like image 166
ahkeno Avatar answered Oct 15 '22 00:10

ahkeno