Skip to main content

Function: lockPage()

lockPage(element): () => void

Defined in: src/ui/pageLock/index.ts:91

Stop the page from scrolling or zooming while it's used inside an element (e.g. the drawing app): wheel and touch scrolling only scroll what can scroll inside it (e.g. a panel), and pinches, Cmd/Ctrl + scroll and Safari's gesture events don't zoom the page. A pen's single touches are left alone, so its taps press buttons. Pair with touch-action: none on the element, which stops touches starting on it from scrolling the page or zooming it with a pinch or double tap. Keyboard zoom (Cmd/Ctrl + plus and minus) isn't stopped, so the page can still be zoomed. Returns a function that stops it.

Parameters​

element​

HTMLElement

Returns​

() => void

Example​

const unlock = lockPage(layout);
unlock();