jQueryMobile Scroll Events

Posted on May 26, 2011 by Anthony James Founder/CEOAnthony James Founder/CEO

jQuery Mobile gives you the ability to detect scrolling events within the device. In this screencast we will write a small script that will popup an alert box when the user either starts to scroll, or when scrolling on the app stops.

Working Example



Script to bind events
$(document).bind(“scrollstop”, function() {
//What occurs when the scrolling starts
alert(“You have stopped scrolling”);
});
$(document).bind(“scrollstart”, function() {
//What occurs when the scrolling starts
alert(“You have started scrolling”);
});

2 Comments

Image of Helaman
Helaman
8 years ago

Hey man, love your stuff. I’m new to this slowly working through it all. I’m developing a test app, it does not scroll very well, as soon as you let go of the screen it ‘pop’s’ back to the top of the screen (best way that I can describe it). I haven’t added anything like you mention in the above tutorial. Hope I don’t sound too dumb…
Cheers

Image of Tony
Tony
8 years ago

Great video!
I’m trying to adapt my website to accept jquerymobile to make it better for ipad 2 users, but i’m having trouble in getting the code working since i have to bind the scrolls to a div that is dinamic created inside autocomplete function of jQuery, any sugestion?

Leave a Reply

Your email address will not be published. Required fields are marked *