disable swipe gestures on input range element

30 views
Skip to first unread message

Jacob Sherwood

unread,
Jun 23, 2015, 6:37:33 PM6/23/15
to chocolat...@googlegroups.com
I have a simple app that uses the chui gesture functions to show a slideout menu based on whether or not the slideout container has the "open" class.

var slideoutActive = false; 
if (!$('.slide-out').hasClass('open')) {
$('body').on('swiperight', function() {
$('.slide-out').addClass('open');
slideoutActive = true;
});

$('body').on('swipeleft', function() {
if (slideoutActive == true) {
  $('.slide-out').removeClass('open');
slideoutActive = false; 
}
});

That all works fine.  The issue is, I also have a range slider input in another article section and if the slider thumb is operated with any bit of force, i.e. not exactly stopping the "swipe" motion before the mouseup it enacts the swipe.

Any thoughts on a way to disable that?

Thanks

Robert Biggs

unread,
Jun 23, 2015, 7:03:48 PM6/23/15
to chocolat...@googlegroups.com
Yeah, that's because the swipe is on the boy tag, therefore when you swipe on the range it also bubbles to the body tag and fires that swipe. I'd try registering a swipe gesture on your range control and then stop it, something like this:

$("#myRangeInput").on('swiperight', function(e) {
    e.stopPropagation();
});

Use whatever swipe gesture you are using for the above code. If that doesn't work, sind me a link to something where I can see how you have everything put together and I'll find a workaround for you.

--
You received this message because you are subscribed to the Google Groups "ChocolateChip-UI" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chocolatechip-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jacob Sherwood

unread,
Jun 23, 2015, 7:31:16 PM6/23/15
to chocolat...@googlegroups.com
Duh... I should have thought of that.  Works like charm.

Thanks!

Robert Biggs

unread,
Jun 23, 2015, 7:32:23 PM6/23/15
to chocolat...@googlegroups.com
No prob. My pleasure.

On Tue, Jun 23, 2015 at 4:31 PM, Jacob Sherwood <jacobs...@gmail.com> wrote:
Duh... I should have thought of that.  Works like charm.

Thanks!

--
Reply all
Reply to author
Forward
0 new messages