Superslides for Mobile

To make the superslide script work also for mobile in addition to the left & right arrow key add this snippet:

$("#slideshow").on("touchstart", function(event){
        var xClick = event.originalEvent.touches[0].pageX;
    $(this).one("touchmove", function(event){
        var xMove = event.originalEvent.touches[0].pageX;
        if( Math.floor(xClick - xMove) > 5 ){
            $(this).superslides('animate', 'next');
        }
        else if( Math.floor(xClick - xMove) < -5 ){
            $(this).superslides('animate', 'prev');
        }
    });
    $("#slideshow").on("touchend", function(){
            $(this).off("touchmove");
    });
});

Leave a Reply

Your email address will not be published. Required fields are marked *