Sha256: a293ae75cdf842eb59d5ef45f5a1345f32ad2fd96468e94201f39ec27eb2164f
Contents?: true
Size: 1.18 KB
Versions: 19
Compression:
Stored size: 1.18 KB
Contents
(function() { $(document).ready(function() { var touchOriginX, touchOriginY; touchOriginX = touchOriginY = 0; $('body').on('touchstart', function(e) { touchOriginX = e.originalEvent.touches[0].clientX; return touchOriginY = e.originalEvent.touches[0].clientY; }); return $('body').on('touchmove', function(e) { var $target, directionX, directionY, isScrollable, isTouchable, scrollables; directionX = e.originalEvent.touches[0].clientX - touchOriginX; directionY = e.originalEvent.touches[0].clientY - touchOriginY; $target = $(e.target); scrollables = $target.closest('.scroll, .scroll-y, .scroll-x'); isTouchable = $target.closest('.touch').length; isScrollable = scrollables.length && ((!(directionY > 0 && scrollables.scrollTop() <= 0) && !(directionY < 0 && (scrollables.scrollTop() + scrollables.innerHeight()) >= scrollables[0].scrollHeight)) || (!(directionX > 0 && scrollables.scrollLeft() <= 0) && !(directionX < 0 && (scrollables.scrollLeft() + scrollables.innerWidth()) >= scrollables[0].scrollWidth))); if (isTouchable || !isScrollable) { return e.preventDefault(); } }); }); }).call(this);
Version data entries
19 entries across 19 versions & 1 rubygems