https://wplabo.idea-hack.com/blog/code-catalog/frontend/27134/
[JQuery] 7 Demo Codes for implementing one page scroll using pagePiling.js

[JQuery] 7 Demo Codes for implementing one page scroll using pagePiling.js

We will introduce the implementation method of jQuery plug-in “pagePiling.js” which can easily create 1 page scroll.

The official site is here.

pagePiling.js plugin | Create a stack of scrolling pages

In this article, after introducing the basic usage, I will introduce the instant code that can be used in copy and paste.

Introduction

Load the following code to make the demo code work.
However, some code, such as Bootstrap, is loaded for convenience.

CSS

css
<!--Only those who need it-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css">
<link rel="stylesheet" href="https://raw.githubusercontent.com/alvarotrigo/pagePiling.js/master/jquery.pagepiling.css">

Javascript

javascript
<!--Only those who need it-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pagePiling.js/1.5.6/jquery.pagepiling.min.js"></script>
<!--Only those who need it-->

Parametor

menuEnter the id of the part you want to menu
sectionSelector Include common classes in each section
sectionColor Background color of each section
anchors Write the same as “data-menuanchor” written in HTML
navigation Dot navigation displayed on the right side of the screen. Set the position, color and text of tooltip

Code collection

pagePiling’s demo is impossible to display properly in post page. So, please go to following Codepen demos.

1: Leave the default setting

This is a minimum setting.

html
<header>
	<nav>
		<h1 class="text-center py-4">pagePiling.js</h1>
	</nav>
</header>
<main>
	<div id="pagepiling">
		<div class="section" id="section1">
			<div class="container">
				<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
				</p>
			</div>
		</div>
		<div class="section" id="section2">
			<div class="container">
				<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
				</p>
			</div>
		</div>
		<div class="section" id="section3">
			<div class="container">
				<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p>
				<p>	The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
				</p>
			</div>
		</div>
		<div class="section" id="section4">
			<div class="container">
				<p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
				</p>
			</div>
		</div>
	</div>
</main>
css
body {
  color: #484848;
  font-family: 'Quicksand', sans-serif;
}

header {
  width: 100%;
  position: fixed;
  z-index: 99;
  margin: 60px auto;
}
header nav ul#nav {
  display: flex;
  justify-content: center;
  list-style: none;
}
header nav ul#nav li a {
  display: block;
  padding: 3px 10px;
  letter-spacing: .1em;
  text-decoration: none;
  color: #4A3C37;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  transition: all 0.3s;
  margin: 0 10px;
}
header nav ul#nav li.active a {
  color: #FFFFFF;
  background: #30B298;
}

main div#pagepiling div.section {
  /* the important one*/
  background-attachment: fixed;
  background-size: auto 80%;
  background-position: 50% 0%;
  background-repeat: no-repeat;
}
JQuery
jQuery(function($){
	$(function() {
		$('#pagepiling').pagepiling({
			sectionSelector: '.section',
			sectionsColor: ['#fff', '#eee', '#ddd', '#ccc'],
		});
});
});

pagePiling.js Ex2: Creating a nav menu

Creating a navigation menu for pages.

html
<header>
	<nav>
		<h1 class="text-center py-4">pagePiling.js</h1>
		<ul id="nav">
			<li data-menuanchor="page1" class="active"><a href="#page1">Page1</a>
			</li>
			<li data-menuanchor="page2"><a href="#page2">Page2</a>
			</li>
			<li data-menuanchor="page3"><a href="#page3">Page3</a>
			</li>
			<li data-menuanchor="page4"><a href="#page4">Page4</a>
			</li>
		</ul>
	</nav>
</header>
<main>
	<div id="pagepiling">
		<div class="section" id="section1">
			<div class="container">
				<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
				</p>
			</div>
		</div>
		<div class="section" id="section2">
			<div class="container">
				<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
				</p>
			</div>
		</div>
		<div class="section" id="section3">
			<div class="container">
				<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p>
				<p>	The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
				</p>
			</div>
		</div>
		<div class="section" id="section4">
			<div class="container">
				<p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
				</p>
			</div>
		</div>
	</div>
</main>
css
body {
  color: #484848;
  font-family: 'Quicksand', sans-serif;
}

header {
  width: 100%;
  position: absolute;
  z-index: 99;
  margin: 60px auto;
}
header nav ul#nav {
  display: flex;
  justify-content: center;
  list-style: none;
}
header nav ul#nav li a {
  display: block;
  padding: 3px 10px;
  letter-spacing: .1em;
  text-decoration: none;
  color: #4A3C37;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  transition: all 0.3s;
  margin: 0 10px;
}
header nav ul#nav li.active a {
  color: #FFFFFF;
  background: #30B298;
}

main div#pagepiling div.section {
  padding: 300px 0;
  /* the important one*/
  background-attachment: fixed;
  background-size: auto 80%;
  background-position: 50% 0%;
  background-repeat: no-repeat;
}
JQuery
jQuery(function($){
	$(function() {
		$('#pagepiling').pagepiling({
			menu: '#nav',
			sectionSelector: '.section',
			sectionsColor: ['#fff', '#eee', '#ddd', '#ccc'],
			anchors: ['page1', 'page2', 'page3', 'page4'],
			navigation: {
				'textColor': '#000',
				'bulletsColor': '#000',
				'position': 'right',
				'tooltips': ['page1', 'page2', 'page3', 'page4']
			},
		});
});
});

pagePiling.js Ex3: Creating a scrollable section

For long text page. You can add scrollable section for each page. In this demo, please compare Page2 and others.

html
<header>
	<nav>
		<h1 class="text-center py-4">pagePiling.js</h1>
		<ul id="nav">
			<li data-menuanchor="page1" class="active"><a href="#page1">Page1</a>
			</li>
			<li data-menuanchor="page2"><a href="#page2">Page2</a>
			</li>
			<li data-menuanchor="page3"><a href="#page3">Page3</a>
			</li>
			<li data-menuanchor="page4"><a href="#page4">Page4</a>
			</li>
		</ul>
	</nav>
</header>
<main>
	<div id="pagepiling">
		<div class="section" id="section1">
			<div class="container">
				<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
				</p>
			</div>
		</div>
		<div class="section pp-scrollable" id="section2">
			<div class="container">
				<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
				</p>
								<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
				</p>
								<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
				</p>
								<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
				</p>
								<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
				</p>
								<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
				</p>
			</div>
		</div>
		<div class="section" id="section3">
			<div class="container">
				<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p>
				<p>	The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
				</p>
			</div>
		</div>
		<div class="section" id="section4">
			<div class="container">
				<p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
				</p>
			</div>
		</div>
	</div>
</main>
css
body {
  color: #484848;
  font-family: 'Quicksand', sans-serif;
}

header {
  width: 100%;
  position: absolute;
  z-index: 99;
  margin: 60px auto;
}
header nav ul#nav {
  display: flex;
  justify-content: center;
  list-style: none;
}
header nav ul#nav li a {
  display: block;
  padding: 3px 10px;
  letter-spacing: .1em;
  text-decoration: none;
  color: #4A3C37;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  transition: all 0.3s;
  margin: 0 10px;
}
header nav ul#nav li.active a {
  color: #FFFFFF;
  background: #30B298;
}

main div#pagepiling div.section {
  padding: 300px 0;
  /* the important one*/
  background-attachment: fixed;
  background-size: auto 80%;
  background-position: 50% 0%;
  background-repeat: no-repeat;
}
JQuery
jQuery(function($){
	$(function() {
		$('#pagepiling').pagepiling({
			menu: '#nav',
			sectionSelector: '.section',
			sectionsColor: ['#fff', '#eee', '#ddd', '#ccc'],
			anchors: ['page1', 'page2', 'page3', 'page4'],
			navigation: {
				'textColor': '#000',
				'bulletsColor': '#000',
				'position': 'right',
				'tooltips': ['page1', 'page2', 'page3', 'page4']
			},
		});
});
});

pagePiling.js Ex4: Change Navigation Setting

Change navigation settings(position・textcolor・bulletsColor・tooltips)

html
<header>
	<nav>
		<h1 class="text-center py-4">pagePiling.js</h1>
		<ul id="nav">
			<li data-menuanchor="page1" class="active"><a href="#page1">Page1</a>
			</li>
			<li data-menuanchor="page2"><a href="#page2">Page2</a>
			</li>
			<li data-menuanchor="page3"><a href="#page3">Page3</a>
			</li>
			<li data-menuanchor="page4"><a href="#page4">Page4</a>
			</li>
		</ul>
	</nav>
</header>
<main>
	<div id="pagepiling">
		<div class="section" id="section1">
			<div class="container">
				<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
				</p>
			</div>
		</div>
		<div class="section" id="section2">
			<div class="container">
				<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
				</p>
			</div>
		</div>
		<div class="section" id="section3">
			<div class="container">
				<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p>
				<p>	The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
				</p>
			</div>
		</div>
		<div class="section" id="section4">
			<div class="container">
				<p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
				</p>
			</div>
		</div>
	</div>
</main>
css
body {
  color: #484848;
  font-family: 'Quicksand', sans-serif;
}

header {
  width: 100%;
  position: absolute;
  z-index: 99;
  margin: 60px auto;
}
header nav ul#nav {
  display: flex;
  justify-content: center;
  list-style: none;
}
header nav ul#nav li a {
  display: block;
  padding: 3px 10px;
  letter-spacing: .1em;
  text-decoration: none;
  color: #4A3C37;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  transition: all 0.3s;
  margin: 0 10px;
}
header nav ul#nav li.active a {
  color: #FFFFFF;
  background: #30B298;
}

main div#pagepiling div.section {
  padding: 300px 0;
  /* the important one*/
  background-attachment: fixed;
  background-size: auto 80%;
  background-position: 50% 0%;
  background-repeat: no-repeat;
}
JQuery
jQuery(function($){
	$(function() {
		$('#pagepiling').pagepiling({
			menu: '#nav',
			sectionSelector: '.section',
			sectionsColor: ['#fff', '#eee', '#ddd', '#ccc'],
			anchors: ['page1', 'page2', 'page3', 'page4'],
			navigation: {
				'textColor': '#000',
				'bulletsColor': '#000',
				'position': 'left',
				'tooltips': ['page1', 'page2', 'page3', 'page4']
			},
		});
});
});

pagePiling.js Ex5: Change Scroll Direction

Change Scroll direction from vertical to horizontal.

html
<header>
	<nav>
		<h1 class="text-center py-4">pagePiling.js</h1>
		<ul id="nav">
			<li data-menuanchor="page1" class="active"><a href="#page1">Page1</a>
			</li>
			<li data-menuanchor="page2"><a href="#page2">Page2</a>
			</li>
			<li data-menuanchor="page3"><a href="#page3">Page3</a>
			</li>
			<li data-menuanchor="page4"><a href="#page4">Page4</a>
			</li>
		</ul>
	</nav>
</header>
<main>
	<div id="pagepiling">
		<div class="section" id="section1">
			<div class="container">
				<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
				</p>
			</div>
		</div>
		<div class="section" id="section2">
			<div class="container">
				<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
				</p>
			</div>
		</div>
		<div class="section" id="section3">
			<div class="container">
				<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p>
				<p>	The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
				</p>
			</div>
		</div>
		<div class="section" id="section4">
			<div class="container">
				<p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
				</p>
			</div>
		</div>
	</div>
</main>
css
body {
  color: #484848;
  font-family: 'Quicksand', sans-serif;
}

header {
  width: 100%;
  position: absolute;
  z-index: 99;
  margin: 60px auto;
}
header nav ul#nav {
  display: flex;
  justify-content: center;
  list-style: none;
}
header nav ul#nav li a {
  display: block;
  padding: 3px 10px;
  letter-spacing: .1em;
  text-decoration: none;
  color: #4A3C37;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  transition: all 0.3s;
  margin: 0 10px;
}
header nav ul#nav li.active a {
  color: #FFFFFF;
  background: #30B298;
}

main div#pagepiling div.section {
  padding: 300px 0;
  /* the important one*/
  background-attachment: fixed;
  background-size: auto 80%;
  background-position: 50% 0%;
  background-repeat: no-repeat;
}
JQuery
jQuery(function($){
	$(function() {
		$('#pagepiling').pagepiling({
			menu: '#nav',
			sectionSelector: '.section',
			sectionsColor: ['#fff', '#eee', '#ddd', '#ccc'],
			anchors: ['page1', 'page2', 'page3', 'page4'],
			navigation: {
				'textColor': '#000',
				'bulletsColor': '#000',
				'position': 'right',
				'tooltips': ['page1', 'page2', 'page3', 'page4']
			},
			direction: 'horizontal',
		});
});
});

pagePiling.js Ex6: Change loop option

Add infinite loop option.

html
<header>
	<nav>
		<h1 class="text-center py-4">pagePiling.js</h1>
		<ul id="nav">
			<li data-menuanchor="page1" class="active"><a href="#page1">Page1</a>
			</li>
			<li data-menuanchor="page2"><a href="#page2">Page2</a>
			</li>
			<li data-menuanchor="page3"><a href="#page3">Page3</a>
			</li>
			<li data-menuanchor="page4"><a href="#page4">Page4</a>
			</li>
		</ul>
	</nav>
</header>
<main>
	<div id="pagepiling">
		<div class="section" id="section1">
			<div class="container">
				<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
				</p>
			</div>
		</div>
		<div class="section" id="section2">
			<div class="container">
				<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
				</p>
			</div>
		</div>
		<div class="section" id="section3">
			<div class="container">
				<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p>
				<p>	The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
				</p>
			</div>
		</div>
		<div class="section" id="section4">
			<div class="container">
				<p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
				</p>
			</div>
		</div>
	</div>
</main>
css
body {
  color: #484848;
  font-family: 'Quicksand', sans-serif;
}

header {
  width: 100%;
  position: absolute;
  z-index: 99;
  margin: 60px auto;
}
header nav ul#nav {
  display: flex;
  justify-content: center;
  list-style: none;
}
header nav ul#nav li a {
  display: block;
  padding: 3px 10px;
  letter-spacing: .1em;
  text-decoration: none;
  color: #4A3C37;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  transition: all 0.3s;
  margin: 0 10px;
}
header nav ul#nav li.active a {
  color: #FFFFFF;
  background: #30B298;
}

main div#pagepiling div.section {
  padding: 300px 0;
  /* the important one*/
  background-attachment: fixed;
  background-size: auto 80%;
  background-position: 50% 0%;
  background-repeat: no-repeat;
}
JQuery
jQuery(function($){
	$(function() {
		$('#pagepiling').pagepiling({
			menu: '#nav',
			sectionSelector: '.section',
			sectionsColor: ['#fff', '#eee', '#ddd', '#ccc'],
			anchors: ['page1', 'page2', 'page3', 'page4'],
			navigation: {
				'textColor': '#000',
				'bulletsColor': '#000',
				'position': 'right',
				'tooltips': ['page1', 'page2', 'page3', 'page4']
			},
			loopTop: true,
			loopBottom: true,
		});
});
});

pagePiling.js Ex7: Change Vertical option

html
<header>
	<nav>
		<h1 class="text-center py-4">pagePiling.js</h1>
		<ul id="nav">
			<li data-menuanchor="page1" class="active"><a href="#page1">Page1</a>
			</li>
			<li data-menuanchor="page2"><a href="#page2">Page2</a>
			</li>
			<li data-menuanchor="page3"><a href="#page3">Page3</a>
			</li>
			<li data-menuanchor="page4"><a href="#page4">Page4</a>
			</li>
		</ul>
	</nav>
</header>
<main>
	<div id="pagepiling">
		<div class="section" id="section1">
			<div class="container">
				<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
				</p>
			</div>
		</div>
		<div class="section" id="section2">
			<div class="container">
				<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
				</p>
			</div>
		</div>
		<div class="section" id="section3">
			<div class="container">
				<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p>
				<p>	The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
				</p>
			</div>
		</div>
		<div class="section" id="section4">
			<div class="container">
				<p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
				</p>
			</div>
		</div>
	</div>
</main>
css
body {
  color: #484848;
  font-family: 'Quicksand', sans-serif;
}

header {
  width: 100%;
  position: absolute;
  z-index: 99;
  margin: 60px auto;
}
header nav ul#nav {
  display: flex;
  justify-content: center;
  list-style: none;
}
header nav ul#nav li a {
  display: block;
  padding: 3px 10px;
  letter-spacing: .1em;
  text-decoration: none;
  color: #4A3C37;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  transition: all 0.3s;
  margin: 0 10px;
}
header nav ul#nav li.active a {
  color: #FFFFFF;
  background: #30B298;
}

main div#pagepiling div.section {
  padding: 300px 0;
  /* the important one*/
  background-attachment: fixed;
  background-size: auto 80%;
  background-position: 50% 0%;
  background-repeat: no-repeat;
}
JQuery
jQuery(function ($) {
  $(function () {
    $('#pagepiling').pagepiling({
      menu: '#nav',
      sectionSelector: '.section',
      sectionsColor: ['#fff', '#eee', '#ddd', '#ccc'],
      anchors: ['page1', 'page2', 'page3', 'page4'],
      navigation: {
        'textColor': '#000',
        'bulletsColor': '#000',
        'position': 'right',
        'tooltips': ['page1', 'page2', 'page3', 'page4'] },

      verticalCentered: false });

  });
});

There are many other options, so please check the link below.

pagePiling.js plugin | Create a stack of scrolling pages

If you liked this article
please click on the "Like!".

Follow on Twetter !

Related Posts