I'm trying to detect scroll events in the Android browser (my specific version is 2.1, but u also work it Wants to get older versions) It seems impossible!
I tried to do this first:
document.addEventListener ('scroll', function () {alert ('test');}, false);
But nothing is starting (except for page loading).
I thought: Okay, we follow this by being mad: 1. Testing of filtrate 2. The voting window. Page Offset We know that when window scrolling is off 3. Manually triggers a user function that I want on the scroll.
Unfortunately, touch events do not trigger ... In fact, when we do not scroll and just tap the screen (TouchStart + Toucan) it works. As soon as we scroll the page (TouchStart + Touchmove + touchend), it breaks everything.
Now my most basic example is only this:
document.addEventListener ('Touchend', function () {warning ('test');}, false) ;
But when we scroll through the finger and leave the touch, then the alert does not look ...
Is anyone suggesting?
You can crawl the source for JQuery Mobile, this Android browser Supports and scroll to event listeners.
$ Event.special.scrollstart = {enabled: true, setup: function () {var thisObject = this, $ this = $ (thisObject), scrolling, timer; Function Trigger (Event, State) {scrolling = state; Var Basic Type = event.type; Event.type = Scroll? "Scrollst": "Scrollstop"; $ .event.handle.call (this object, event); Event.type = Basic Type; } // iPhone triggers after a short delay; Trigger (event, true);} Use touch_move instead of the timer (scrollEvent, function) {if (! $. Event.special.scrollstart.enabled) {return;}; timer = settimeout (function ( ) {Trigger (event, false);}, 50);}); }};
Comments
Post a Comment