xmen404
xmen404

Reputation: 23

Revolution slider not sliding on mobile - mobile touch swipe not working

I'm using revolution slider 5 and it's working perfectly on desktop but on mobile it just won't swipe slides by mobile touch. Slides are turning automatically but they won't slide on manual swipe. Do you have idea what is causing that?

Thank you!

Upvotes: 2

Views: 12352

Answers (2)

Tone Williams
Tone Williams

Reputation: 51

Slider Revolution Touch Settings

As defined by the developer's documentation, you can manually enable and disable vertical dragging in the slider's settings under the Navigation panel.

Upvotes: 5

Goran
Goran

Reputation: 748

It's not working because most likely your slide's themselves are hyperlinked.

To solve this problem copy paste this code in custom javascript section in settings of your slider

(function() {

if(!('ontouchend' in document)) return;
var pageX, pageY, newX, newY, linked;

jQuery('.rev_slider').on('touchstart', function(event) {

    newX = newY = false;

    var target = jQuery(event.target),
    clas = target.attr('class');
    event = event.originalEvent;

    if(event.touches) event = event.touches[0];
    pageX = event.pageX;
    pageY = event.pageY;

    if(target.is('a') || target.closest('a').length) linked = target;

}).on('touchmove', function(event) {

    event = event.originalEvent;
    if(event.touches) event = event.touches[0];

    newX = event.pageX;
    newY = event.pageY;
    if(Math.abs(pageX - newX) > 10) event.preventDefault();

}).on('touchend', function(event) {

    if(newX !== false && Math.abs(pageX - newX) > 30) {

        eval('revapi' + jQuery(this).closest('.rev_slider_wrapper').attr('id').split('rev_slider_')[1].split('_')[0])[pageX > newX ? 'revnext' : 'revprev']();

    }
    else if((linked && newY === false) || (linked && Math.abs(pageY - newY) < 10)) {

        linked = linked.is('a') ? linked : linked.closest('a');
        if(linked.length) {

            if(linked.attr('target') === '_blank') {    
                window.open(linked.attr('href'));
            }
            else {
                window.location = linked.attr('href');
            }

        }

    }

    linked = newX = false;

});})();

This question is also well documented on Themepunch (author of the plugin) http://www.themepunch.com/faq/mobile-touch-swipe-slide-links-5-0/

Upvotes: 5

Related Questions