1

I am working on a jquery mobile app. I'm detecting scroll event to do something when someone starts scrolling. Its working fine in desktop browsers and android browsers but in ios the scroll event works after the scroll stops rather than working at the start of scrolling.

Here's my code -

        $("#main").on('scroll', function(){
            $("#bottom-fixed-contents").fadeOut("fast");
            clearTimeout( $.data( this, "scrollCheck" ) );
            $.data( this, "scrollCheck", setTimeout(function() {
                $("#bottom-fixed-contents").fadeIn("slow");
            }, 500) );
        });

CSS

#main {
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    font-family: 'Helvetica';
    -webkit-overflow-scrolling: touch;
}

#bottom-fixed-contents {
    position: fixed;
}
Shuvro
  • 1,499
  • 4
  • 14
  • 34
  • maybe this will help : http://stackoverflow.com/questions/18753367/jquery-live-scroll-event-on-mobile-work-around – Muhamed Jan 13 '15 at 07:04
  • or this one: http://stackoverflow.com/questions/2863547/javascript-scroll-event-for-iphone-ipad Anyway, this is recurent on ios, there is many many relative questions to this. You should be able to find a workaround – A. Wolff Jan 13 '15 at 07:06
  • @A.Wolff & Muhamed Already seen those problems, worked on many workarounds, the touchmove is a good alternative, but in that case I have to detect whether I'm at the top or bottom of the document otherwise the event still fires on touch without any scrolling. I just wanted to know whether there is any solution to this problem by far usng default scroll event, or it's still the bug as it was? – Shuvro Jan 13 '15 at 07:37
  • And not to forget in case of using touchmove I also have to check for the left and right swipe events which are not counted as scroll events. – Shuvro Jan 13 '15 at 07:47

0 Answers0