davetayls / jquery.kinetic

Add kinetic scrolling functionality to a container using mouse or touch devices
http://davetayls.me/jquery.kinetic
MIT License
420 stars 86 forks source link

Kinetic event for movement from kinetic only #97

Open iamdriz opened 8 years ago

iamdriz commented 8 years ago

Is it possible to have an event that fires only when kinetic has been dragged?

Currently if I have:

$('.balls__bar').kinetic({
    cursor: 'default',
    x: true,
    y: false,
    moved: function(){
        ipc.send('projector', { func: 'scrollBallBar', params: [$('.stage-inner').width(), $('.balls__bar').scrollLeft()] });
    }
});

The moved event will fire if .balls__bar is scrolled by another means. I only want to catch kinetic movement by dragging!

UziTech commented 8 years ago

You could check this.mouseDown === true

$('.balls__bar').kinetic({
    cursor: 'default',
    x: true,
    y: false,
    moved: function(){
        if (this.mouseDown) {
            ipc.send('projector', { func: 'scrollBallBar', params: [$('.stage-inner').width(), $('.balls__bar').scrollLeft()] });
        }
    }
});