javascript - Is there any event to detect momentum scrolling using jQuery on iOS device after touch end? -
i toggle menu @ bottom during scroll event. i've created fixed menu show/hides based on position top. event fires during touch. there way event triggered when web page scrolling after finger lifted off device? scroll event works on android device.
function togglemenu() { if ($('.menu').offset().top < $('.fixed-menu').offset().top + 32) { $('.fixed-menu').css('visibility', 'hidden'); } else { $('.fixed-menu').css('visibility', 'visible'); } } $(window).on("load resize scroll touchstart touchmove touchend", function (e) { togglemenu(); }); html, body { height: 100%; -webkit-overflow-scrolling: touch; overflow-y: scroll; }
as you're listening touchstart
, touchmove
, touchend
of course trigger on touch well. try make trigger on scroll
, , add timeout see if scrolling has stopped or not.
$(document).on("scroll", function() { var position = $(document).scrolltop(); hidemenu(); settimeout(function() { if (position == $(document).scrolltop()) // have stopped scrolling showmenu(); }, 100); });
Comments
Post a Comment