i'm currently sitting on an interesting problem:
I have a input type range, rotated by 270deg using the css transform property.
On desktop browsers this works fine but on mobile devices, when i try to use the range fader, the screen is scrolling instead.
My first attempt to fix this was using the inputs focus and blur events to disable the scrolling function of the page, but these events don't seem to be triggered on mobile devices.
Has anyone already dealt with this problem?
I made a plunkr to reproduce the problem:
https://embed.plnkr.co/FrdJZqeB8zqQxjN7zS8u/
If you are not on a mobile browser, just enable the device browser in the top left of the chrome inspector
Thanks
Edit: The -webkit-appearance: slider-vertical;
css property is not an option for me because i need css styles applied to my fader: <input type="range"> style not applies to thumb when it is vertical
Edit:
Found a solution that works for me, as thepio proposed:
var element = document.getElementById('range-input');
element.addEventListener('touchmove', function(event){
//event.preventDefault();
});
Interestingly this works only without the event.preventDefault() line