rochal / jQuery-slimScroll

small jQuery plugin that transforms any div into a scrollable area with a nice scrollbar. Demo and more:
http://rocha.la/jQuery-slimScroll
2.23k stars 926 forks source link

[Violation] output in chrome console #311

Open Argun opened 5 years ago

Argun commented 5 years ago

[Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952

Chrome output above violation message after chrome v51, please refer this.

samirindiaittech commented 5 years ago

@Argun have you got any solution yet for this?

have update slimscroll..js function attachwheel(target) with

function attachWheel(target) { if (window.addEventListener) { target.addEventListener('DOMMouseScroll', _onWheel, { capture: false, passive: false }); target.addEventListener('mousewheel', _onWheel, { capture: false, passive: false }); } else { document.attachEvent("onmousewheel", _onWheel) } }

still getting error in some places,

codingforme commented 5 years ago

@Argun have you got any solution yet for this?

have update slimscroll..js function attachwheel(target) with

function attachWheel(target) { if (window.addEventListener) { target.addEventListener('DOMMouseScroll', _onWheel, { capture: false, passive: false }); target.addEventListener('mousewheel', _onWheel, { capture: false, passive: false }); } else { document.attachEvent("onmousewheel", _onWheel) } }

still getting error in some places,

you can use the following code to distinguish whether the passive attribute is supported.

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