Problem:
What happens is if you swipe across the range slider the event bubbles up and invokes the swiperight event. We’ve tried several ways of mitigating this.
I’m using jQuery 3.4.1 and jquery.touch.js - (link points to the open issue on github) and F7 version 5.2.0
How I implemented my range sliders, swipe events etc.
There’s a series of range sliders in my settings page defined like this:
<div class="block-title">Money</div>
<div class="list simple-list">
<ul>
<li>
<div class="item-cell width-auto flex-shrink-0">
<span class="fas fa-coins color-yellow"></span>
</div>
<div class="item-cell flex-shrink-3">
<!-- range slider, enable labels -->
<div class="range-slider range-slider-init color-orange no-swipe" data-label="true">
<input id="qMoney" class="no-swipe" type="range" min="0" max="200" step="1" value="25">
</div>
</div>
<div class="item-cell width-auto flex-shrink-0">
<span class="fas fa-dollar-sign color-green"></span>
</div>
</li>
</ul>
</div>
In the page init code I have this:
function settingsPageReady()
{
$("#settingsPage").on("swiperight", function (event) {
app.views.main.router.back('/account/', {force: 'true', ignoreCache: true});
});
}
Inside the app.js I have disabled all of the F7 swiping like this:
iosDynamicNavbar: false, // disable swipeback events (we handle those in the touch handler)
iosSwipeBack: false,
mdSwipeBack: false,
auroraSwipeBack: false,
Inside the settingsPageInit I have also tried all of these and none of them get invoked.
$('#settingsPage').on('touchmove mousemove', 'input[type="range"]', function(e) {
e.stopPropagation();
});
$('#qMoney').on('touchmove mousemove', 'input[type="range"]', function(e) {
e.stopPropagation();
});
$('.range-slider').on('touchmove mousemove', 'input[type="range"]', function(e) {
e.stopPropagation();
});
BenMajor created a fiddle which demonstrates that the problem can be mitigated in pure html by adding using a “touchmove mousemove” handler to stop the event propagation but under F7 this doesn’t work.
So, what’s the solution?