javascript - Dealing with live js scrolltop values on ios -
i know 1 asked much, i've been struggling 2 days now, , haven't got idea of how achieve goal.
i have header, it's absolute , default it's top property equal window height. since have hamburger website, it's header positioned on bottom of landing slide, or @ top of first info slide.
when user scrolls first slide, header must stick top.
on desktop, did:
$(window).on('scroll', function () { if ($(window).scrolltop() >= h && !header.hasclass('sticky')) { header.addclass('sticky'); } else if ($(window).scrolltop() < h) { header.css('top', h); header.removeclass('sticky'); } else { // return false; }; });
and it's working nice. on iphones/ipads header gets it's "sticky" state when scrolling finished. means if user swipes on it's ios device hard, scroll last section , when scroll animation end, user see header.
any solution achieve desktop behavior on mobile?
Comments
Post a Comment