Umer Farooq
Umer Farooq

Reputation: 91

Touch swipe vertical scroll in a div

I am using Jquery Touch Swipe plugin for swipe functionality in mobile views of my project. All the rest of the functionality is working fine except the vertical scroll. I want the user to be able to scroll down to see more of the data. My guess is that "allowPageScroll" is the property that does that but instead it scrolls down the page rather than the particular div. Here is my function that performs this functionality.

javascript

function responsiveFunction() {
    if (window.innerWidth <= 767) {
        $("#ListData>div").hide();
        $("#ListData>div").first().show();
        $("#ListData").swipe({
            swipe: function (event, direction, distance, duration, fingerCount, fingerData) {
                if (direction === 'left') {                      
                    $("#ListData>div:visible").hide().next("#ListData>div").addBack().last().show();
                }
                else if (direction === 'right') {
                    $("#ListData>div:visible").hide().prev("#ListData>div").addBack().first().show();
                } else { }
            },
            threshold: $(window).width,
            fingers: 'all',
            allowPageScroll: "vertical"
        });
    }
}

Upvotes: 3

Views: 827

Answers (0)

Related Questions