darsain / sly

JavaScript library for one-directional scrolling with item based navigation support.
http://darsa.in/sly
2.87k stars 497 forks source link

Scroll Jank Issue #269

Open san85 opened 7 years ago

san85 commented 7 years ago

Hi,

We get the scroll jank issue due to this below function in sly.min.js

u.on(y, function(a) { var b = a.originalEvent[r], c = +new Date; (!b || b.options.scrollHijack < c - J) && (J = c) }),

In console we see,

"Handling of 'wheel' input event was delayed for 625 ms due to main thread being busy. Consider marking event handler as 'passive' to make the page more responsive."

Why can't we make it like this below structure to fix this issue.

var supportsTempPassive = false; try { var opts = Object.defineProperty({}, 'passive', { get: function() { supportsTempPassive = true; } }); window.addEventListener("test", null, opts); } catch (e) {}

document.addEventListener(y, function(a) { var b = a.originalEvent[r], c = +new Date; (!b || b.options.scrollHijack < c - J) && (J = c) },{ passive: supportsTempPassive }),

@Admin/Product Owner, Can you please change and commit this or can we change the script in local