Smoothly Scroll Through Sections With Custom Events - jQuery scrollControl.js

File Size: 3.81 KB
Views Total: 1424
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Smoothly Scroll Through Sections With Custom Events - jQuery scrollControl.js

scrollControl.js is a lightweight jQuery plugin that smoothly scrolls through a set of viewport-sized page sections with custom triggers and/or events.

Ideal for modern one page scrolling website & web applications.

Supports any JavaScript events and keycodes such as mousewheel, swipe, drag, etc.

How to use it:

1. Create viewport-sized page sections using the following HTML & CSS.

<section id="section1">
  <h1>Section #1</h1>
<section id="section2">
  <h1>Section #2</h1>
<section id="section3">
  <h1>Section #3</h1>
<section id="section4">
  <h1>Section #4</h1>
section {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;

2. Insert the JavaScript file scrollControl.js after jQuery.

<script src="" 
<script src="scrollControl.js"></script>

3. Initialize the plugin.

var scrollControl = ScrollControl([

4. Smoothly scroll through the page sections with up/down keys.

$(document).keydown(function(e) {
  if (e.which==38) {
  } else if (e.which==40) {
  } else if (e.which==32) {

5. Or make anchor links smoothly scroll to a specified page sections.

$(document).on('click', 'a.smooth', function(event){
  smoothScrollTo($.attr(this, 'href'));

This awesome jQuery plugin is developed by pedrouid. For more Advanced Usages, please check the demo page or visit the official website.