Stereobit / dragend

dragend JS – a touch ready, full responsive, content swipe script
http://stereobit.github.com/dragend/
MIT License
485 stars 114 forks source link

Add direction to onSwipeStart callback so one can predict the target page #64

Closed hashworks closed 9 years ago

hashworks commented 9 years ago

This way I can do

var dragend = new Dragend(document.getElementById('content'), {
    'onSwipeStart': function(container, activeElement, page, direction) {
        if (direction == 'left' || direction == 'down') {
            page = page + 1;
        } else if (direction == 'right' || direction == 'up') {
            page = page - 1;
        } else {
            return;
        }
        doSomethingToTargetPage(page);
    }
});