Javascript: Stop scrolling after a scroll fling - javascript

On mobile devices (or most devices with touch screens) it is possible to scroll via a fling. The scrolling then goes on (but decelerates), even when the user lifted his/her finger from the screen.
Is it possible to stop that additional scrolling with Javascript (jquery)?

Related

How to detect mobile scroll motion without touch the screen

I have a jquery that can show and hide advertisement on my website when ever the user is scrolling to a certain point in that page. It's working on desktop but on mobile, to make it work, I have to scroll without remove my finger from the screen. Whenever my finger is remove from the screen, then the code is no longer recognise the scroll.
My question, how to detect the scroll when my finger is off the screen but the screen is still scrolling?
$window.on('scroll', goScroll);
$(document.body).on('touchmove', goScroll);

Slowing down scroll speed while using trackpad

I am currently developing a website that has some animations on scroll. The problem is that animation is triggered too fast when the user is scrolling using a touchpad. My question is: Is it possible to slow down the scrolling speed on touchpad or at least determine if user uses a mouse wheel or trackpad?

JavaScript/HTML (Mobile): When a page is partially scrolled, I can't do anything until it's finished scrolling

I have a web page which has a scroll area, and some buttons outside of the scroll area. In mobile browsers or emulated mobile mode in pc browsers, when the scroll area is auto-scrolling (after the finger swipe on the screen quickly then remove the finger from screen), I can't tap the buttons or to do anything until the scrolling is finished. I tried Chrome and Safari, they all have the same problem. Is there any way to fix this? I want to trigger the button when it's scrolling.

Hammer JS swipe not working on the document body

I'm using HammerJS to detect left swipes on touch screen devices. I'm trying to open a slide-out menu every time the user swipes left anywhere on the page when browsing on a touch-screen device. It works fine in portrait mode but not in landscape. I thought it might be because the direction might be changing from left to up/down, however the alert doesn't happen at all when the device is landscape. There is a fixed-position menu bar at the top of the page and it always works when swiping left on that, but not on the rest of the page. The same problem occurs on iOS Safari, and on Android Browser, Chrome, and Firefox.
I noticed on the HammerJS documentation it says "When calling Hammer() to create a simple instance, the pan and swipe recognizers are configured to only detect horizontal gestures." (http://hammerjs.github.io/recognizer-pan/). Could this be the cause of the problem? In landscape what were horizontal gestures become vertical? If so is there a workaround?
Any ideas? Thanks.
Hammer = require "hammerjs"
#body = new Hammer document.body
#body.on "panend", (e) =>
alert "panned!"
e.preventDefault()
if e.direction is Hammer.DIRECTION_LEFT
# open the menu

Remove momentum on scrollbar in javascript

I want to remove the momentum on scrollbar. I.e. when the user is not scrolling physically. The screen stop scrolling immediately.
I'm using a Mac with touchpad.
I guess this only happens when you are scrolling using scrolling gestures (two finger up/down swipe)? This is a system feature and cannot be disabled via Browser features or CSS. To turn it off go to System Preferences > Trackpad and disable Scrolling "with Intertia".

Categories

Resources