add cancelOn selector to disable dragging when mousedown on matched elements #5

Closed
tborychowski opened this Issue Sep 27, 2010 · 3 comments

Projects

None yet

2 participants

@tborychowski

Currently I'm doing something like this (it works but it certainly can be improved :-)):

I've added to options:

   cancelOn: ''

than at the beginning of "start" method:

   if ($(event.target).is(event.data.options.cancelOn)) return true;

to disable dragging all matched elements (children of the main event.data.target element)

but this didn't work.until I commented out this line:

   .bind(o.events.ignored, o.noop); // disable proprietary drag handlers

With all this it works perfectly!
But I'm sure you can do it better :-)
Thanks.

@tborychowski

I've improved the start method piece:

   var $t=$(event.target), cancelOn=event.data.options.cancelOn
   if ($t.is(cancelOn) || $t.parents(cancelOn).length) return true;

with this you can define cancelOn in overscroll declaration like:

$('#scroller').overscroll({ 
   cancelOn: '.aBox'
});

and overscroll will not drag the parent scroller when mouse clicked .aBox or any element inside it.

@azoff
Owner

Hmm, this is interesting... I'll push it up on the priority scale since you already put in the work for it ;)

@azoff
Owner

This is now implemented in 1.4.2 (will release soon!)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment