UNPKG

smooth-scrollbar

Version:

Customize scrollbar in modern browsers with smooth scrolling experience.

24 lines 859 B
export function update(scrollbar) { var newSize = scrollbar.getSize(); var limit = { x: Math.max(newSize.content.width - newSize.container.width, 0), y: Math.max(newSize.content.height - newSize.container.height, 0), }; // metrics var containerBounding = scrollbar.containerEl.getBoundingClientRect(); var bounding = { top: Math.max(containerBounding.top, 0), right: Math.min(containerBounding.right, window.innerWidth), bottom: Math.min(containerBounding.bottom, window.innerHeight), left: Math.max(containerBounding.left, 0), }; // assign props scrollbar.size = newSize; scrollbar.limit = limit; scrollbar.bounding = bounding; // update tracks scrollbar.track.update(); // re-positioning scrollbar.setPosition(); } //# sourceMappingURL=update.js.map