Lock And Unlock Page Scroll Using KIT Locker JavaScript Plugin

Category: Javascript | September 3, 2018
Author: Natteke
Views Total: 681
Official Page: Go to website
Last Update: September 3, 2018
License: MIT

Preview:

Lock And Unlock Page Scroll Using KIT Locker JavaScript Plugin

Description:

KIT Locker is a pure JavaScript plugin to lock and unlock scrolling of your webpage when needed.

Ideal for preventing page scrolling when a modal popup opens or the user scrolls through content within a container element.

How to use it:

Include the JavaScript and Stylesheet on the page.

<link href="prod/kit.locker.min.css" rel="stylesheet">
<script src="prod/kit.locker.js"></script>

Initialize the plugin.

kit.locker.createLocker()

Prevent the page scrolling.

kit.locker.lock();

Unlock.

kit.locker.unlock();

Execute functions when the page is locked or unlocks.

kit.locker.createLocker({
  onLock: function(){
   console.log("Page locked!")
  });

  onRelease(): function(){
   console.log("Page unlocked!")
  });
})

You Might Be Interested In:


Leave a Reply