mattbryson / TouchSwipe-Jquery-Plugin

TouchSwipe is a jquery plugin to be used with jQuery on touch input devices such as iPad, iPhone etc.
http://labs.rampinteractive.co.uk/touchSwipe/
Other
4.05k stars 1.68k forks source link

want swipeUp event to occur if and only if scrolled to the bottom of a div? #331

Closed m-jabeen closed 5 years ago

m-jabeen commented 6 years ago

I want to fire the swipeUp event if and only if scrolled to the bottom of a div. For this, I created a scroll-wrapper class inside the body and bind scroll function to it as follows:

$('.scroll-wrapper').bind('scroll', chk_scroll);

var scrollFlag = true;

function chk_scroll(e) { var elem = $(e.currentTarget); //checks if scrolled to the bottom reachToBottom = ((elem[0].scrollHeight - elem.scrollTop()) == elem.outerHeight()) ? true : false;

if (reachToBottom && scrollFlag === true) {
          $(".div-card-table-bkg").swipe({
        swipeUp: function(){
            /* the following div is hidden by default, only displayed after reach to the bottom of 
                                the screen and then swipe up */
            $(".qrdiv").show();
            scrollFlag = false;
            $(".div-card-table-bkg").swipe('destroy');
        },
    });
}
return true;

}

The problem is, once I reached to the bottom of the scroll-wrapper div, then if I swipe to the down direction and then swipe up, the qrdiv becomes visible, where I want to display the qrdiv if and only if swipe up from the bottom position of scroll-wrapper div. any solution?

vishalp36 commented 6 years ago

Any solutions?

Federico39 commented 6 years ago

Please remove me. Git hub is a super interesting world, but too time-consuming for me. Sorry.

Kind regards Federico Kunz

On Fri, Apr 6, 2018 at 2:39 PM, vishalp36 notifications@github.com wrote:

Any solutions?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mattbryson/TouchSwipe-Jquery-Plugin/issues/331#issuecomment-379240658, or mute the thread https://github.com/notifications/unsubscribe-auth/AHzGdWK6TKq9Od1119QDuufddZsW0pF4ks5tl2H1gaJpZM4Pv-M1 .

-- saludos andaluces Federico

mattbryson commented 5 years ago

closing as almost a year old and no solutions proposed. I would suggest using the generic swipe handler and checking the direction and distance in there.