Creating A Horizontal Scrolling Website with jQuery horizonScroll.js

File Size: 118 KB
Views Total: 23751
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Creating A Horizontal Scrolling Website with jQuery horizonScroll.js

horizonScroll.js is a jQuery plugin that enables mobile-compatible horizontal scrolling on your one page website, similar to the full window page slider.

How to use it:

1. Load jQuery library and the jQuery horizonScroll.js in your project.

<script src="//"></script>
<script src="jquery.horizonScroll.js"></script>

2. Load the jQuery touchSwipe plugin for touch swipe / mouse drag support.

<script src="//"></script>

3. Create next/prev navigation.

<div class="horizon-prev"><img src="images/l-arrow.png"></div>
<div class="horizon-next"><img src="images/r-arrow.png"></div>

4. Create sectioned content for your website.

<section data-role="section" id="section-section1"></section>
<section data-role="section" id="section-section2"></section>
<section data-role="section" id="section-section3"></section>
<section data-role="section" id="section-section4"></section>

5. The required CSS for your one page scrolling website.

body {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;

section {
  float: left;
  display: block;
  height: 100%;
  padding: 0;
  margin: 0;

.horizon-next {
  position: fixed;
  top: 50%;
  margin-top: -24px;
  z-index: 9999;

.horizon-prev { left: 20px; }

.horizon-next { right: 20px; }

6. Initialize the plugin with default options.


7. Default plugin options.


scrollTimeout: null,
scrollEndDelay: 250,
scrollDuration: 400,
i: 0,
limit: 0,
docWidth: 0,
sections: null,
swipe: true,
fnCallback: function (i) {


Change log:


  • Added support for element IDs using scrollTo()
  • Added support for animating the scroll to a section via hash links


  • A small bug fix where the index was being set in the scroll left and scroll right functions but not the scroll to method. Now it is always set in scroll to because all methods call it.

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