2

Is there any way to load data while scrolling in jquery for Iphone (mobile websites). This example works in Safari, Chrome but not in the iPhone: http://www.webresourcesdepot.com/dnspinger/

Thanks

Bob Nowak
  • 21
  • 2
  • looks like the same issue here: http://stackoverflow.com/a/6782148/844726 -- you need to add the 60px url field to the `$(window).scrollTop()` – swatkins Jun 15 '12 at 21:06

1 Answers1

0

Yes there is a way - the best to do it is initiating an AJAX request to a server side page to retrieve more data from the database.

The website you have mentioned is doing just that however on a device you will need to take the URL box into consideration I believe this is 60px?

$(window).scroll(function () {
    $(window).scrollTop() + 60 == ($(document).height() - $(window).height()) {
        doFunction();
    }
});

doFunction() {
    $.post('getPosts.php?action=loadmore&endId=' + $('.element:last').attr('id'));

    function(data) {
        if (data != '') {
            $(".element:last").after(data);
        }
    }
}

This is just an example of how you could do this?

Ryank
  • 507
  • 2
  • 6