UNPKG

monday-sdk-js

Version:

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/mondaycom/monday-sdk-js/blob/master/LICENSE)   [![npm version](https://img.shields.io/npm/v/monday-sdk-js.svg?style=flat)](https://www.npmjs.com/package/monday-

23 lines (18 loc) 947 B
let scrollHelperInitialized = false; function initScrollHelperIfNeeded() { if (scrollHelperInitialized) return; // will prevent white flashes when scrolling using wheel events on laptops // with dual gpu when using the power saving gpu // it's reproduceable on macbook when not connected to an external display scrollHelperInitialized = true; // when an elemnt cover the scollable element, wheel events are synchronous on chromium based browsers const css = 'body::before { content: ""; position: fixed; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; z-index: 2147483647; /* mondaySdk css - can be disabled with: mondaySdk({withoutScrollHelper: true }) */ }'; const style = document.createElement("style"); style.appendChild(document.createTextNode(css)); const head = document.head || document.getElementsByTagName("head")[0]; head.appendChild(style); } module.exports = { initScrollHelperIfNeeded };