Skip to content

toggleBodyOverflow

kherP edited this page Jan 2, 2020 · 2 revisions

This utility inserts a class into the body tag to disable overflow to avoid background scrolling.

Example

toggleBodyOverflow(true);
console.log(document.body.classList.contains("overflow-hidden")); // true

Properties

Param Type Description
toggle boolean to toggle class overflow-hidden1 in document.body

Footnotes

  1. It inserts the class overflow-hidden which is a bootstrap class. If you are not using bootstrap, please make sure that the class is defined with overflow: hidden;
Clone this wiki locally