• Stars
    star
    768
  • Rank 56,796 (Top 2 %)
  • Language
    JavaScript
  • License
    GNU General Publi...
  • Created almost 10 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The javascript version of the infamous jQuery One Page Scroll without relying on jQuery.

#Pure JS One Page Scroll by Pete R. Pure JS One Page Scroll is a javascript version of One Page Scroll. The plugin will let you create an Apple-like one page scroll website (iPhone 5S website) without replying on jQuery.

Created by Pete R., Founder of BucketListly

License: Attribution-ShareAlike 4.0 International

Requirement

NONE! No more jQuery!

Demo

View demo

##Looking for jQuery version? jQuery Version

##Looking for Zepto JS version? Zepto Js Version

Compatibility

Modern browsers such as Chrome, Firefox, and Safari on both desktop and smartphones have been tested. Not tested on IE.

Basic Usage

One Page Scroll let you transform your website into a one page scroll website that allows users to scroll one page at a time. It is perfect for creating a website in which you want to present something to the viewers. For example, Apple's iPhone 5S website uses the same technique.

To add this to your website, simply include onepagescroll.js and onepage-scroll.css into your document's <head> and call the function as follows:

<body>
  ...
  <div class="main">
    <section>...</section>
    <section>...</section>
    ...
  </div>
  ...
</body>

Container "Main" must be one level below the body tag in order to make it work full page. Now call the function to activate as follows:

onePageScroll(".main", {
   sectionContainer: "section",     // sectionContainer accepts any kind of selector in case you don't want to use section
   easing: "ease",                  // Easing options accepts the CSS3 easing animation such "ease", "linear", "ease-in", 
                                    // "ease-out", "ease-in-out", or even cubic bezier value such as "cubic-bezier(0.175, 0.885, 0.420, 1.310)"
   animationTime: 1000,             // AnimationTime let you define how long each section takes to animate
   pagination: true,                // You can either show or hide the pagination. Toggle true for show, false for hide.
   updateURL: false,                // Toggle this true if you want the URL to be updated automatically when the user scroll to each page.
   beforeMove: function(index) {},  // This option accepts a callback function. The function will be called before the page moves.
   afterMove: function(index) {},   // This option accepts a callback function. The function will be called after the page moves.
   loop: false,                     // You can have the page loop back to the top/bottom when the user navigates at up/down on the first/last page.
   keyboard: true,                  // You can activate the keyboard controls
   responsiveFallback: false        // You can fallback to normal page scroll by defining the width of the browser in which
                                    // you want the responsive fallback to be triggered. For example, set this to 600 and whenever 
                                    // the browser's width is less than 600, the fallback will kick in.
});

And that's it. Now, your website should work the same way Apple's iPhone 5S website does. You should be able to swipe up/down as well (thanks to Eike Send for his swipe events!) when viewing your website on mobile phones.

Public Methods

You can also trigger page move programmatically as well:

moveUp(".main")

This method allows you to move the page up by one. This action is equivalent to scrolling up/swiping down.

  moveUp(".main");

moveDown(".main")

This method allows you to move the page down by one. This action is equivalent to scrolling down/swiping up.

  moveDown(".main");

moveTo(".main", page_index)

This method allows you to move to the specified page index programatically.

  moveTo(".main", 3);

Callbacks

You can use callbacks to perform actions before or after the page move.

beforeMove(next_page_index, next_section_element)

This callback gets called before the plugin performs its move.

  onePageScroll(".main", {
    beforeMove: function(index, next_el) {
      ...
    }
  });

afterMove(next_page_index, next_section_element)

This callback gets called after the move animation was performed.

  onePageScroll(".main", {
    afterMove: function(index, next_el) {
      ...
    }
  });

If you want to see more of my plugins, visit The Pete Design, or follow me on Twitter and Github.

Other Resources

More Repositories

1

onepage-scroll

Create an Apple-like one page scroller website (iPhone 5S website) with One Page Scroll plugin
JavaScript
9,545
star
2

simple-text-rotator

Add a super simple rotating text to your website with little to no markup
HTML
750
star
3

loading-bar

Add a Youtube-like loading bar to all your ajax links
HTML
662
star
4

label_better

Label your form input like a boss with beautiful animation and without taking up space
JavaScript
517
star
5

flat-shadow

A small jQuery plugin that will automatically cast a shadow creating depth for your flat UI elements
HTML
483
star
6

panorama_viewer

Embed panorama photos on your website with Panorama Viewer
JavaScript
472
star
7

wheel-menu

Add a fully customisable Path-like wheel menu button to your website
HTML
403
star
8

interactive_3d

Create a 3D interactive object using images and one simple JS call
JavaScript
378
star
9

notify-better

An all in one jQuery plugin that let you change your favicon, browser's title and more to reflect new notifications
JavaScript
375
star
10

tiltedpage_scroll

Create a beautiful 3D tilted effect on scroll with jQuery Tilted Page Scroll plugin
JavaScript
323
star
11

autofix_anything

Fix position of anything on your website automatically with one js call
JavaScript
313
star
12

interactive_bg

Create an interactive moving background/object that reacts to viewer's cursor
JavaScript
232
star
13

tip_cards

Create a card layout that let your user flip through it like you see on Google Tips
JavaScript
214
star
14

shuffle-images

The Simplest Way to shuffle through images in a Creative Way
JavaScript
212
star
15

zepto-onepage-scroll

Zepto One Page Scroll is the javascript version of the infamous jQuery One Page Scroll.
JavaScript
186
star
16

adaptive-modal

Create modal windows that can be morphed from anything
JavaScript
168
star
17

fancy-scroll

Add Overflow Scroll Effect like on iOS/Android but for your website
HTML
157
star
18

immersive-slider

Create an immersive slider that changes the whole container to match the viewing slide
JavaScript
139
star
19

square_menu

Create a Square-like Menu Animation for Website using jQuery and CSS3
CSS
125
star
20

fly_sidemenu

Recreate an Airbnb iOS7 App Menu Animation using CSS3 and jQuery
CSS
113
star
21

flipout_cards

Create a Dynamic Multi Level Flip Out Cards
CSS
111
star
22

jumpto

A plugin that let you create a smooth jump to sub navigational menu in one JS call
JavaScript
106
star
23

fullpage-menu

Create a Full Page, Fully CSS3 Animated Menu for your Navigation with Full Page Menu
CSS
106
star
24

zoom-scroller

Create a Subtle Zoom Animation on Images while Scrolling
JavaScript
99
star
25

let_it_snow

Create and Control a Festive Snow on Your Website using HTML5 Canvas
JavaScript
93
star
26

endpage-box

A plugin that let you add an end page box that will display when scrolled to the bottom.
HTML
86
star
27

flipping_gallery

Create a simple but beautiful 3D flipping gallery with on JS call
JavaScript
79
star
28

subscribe-better

Create a better, highly customizable subscription modal or newsletter signup window with jQuery Subscribe Better
CSS
74
star
29

planetarium

Construct an Interactive Planet and Build the Universe on your website
JavaScript
58
star
30

flipping_text

Create a ticking text intro animation for your typography.
JavaScript
55
star
31

fullpagenav

Create a fully responsive and dynamic full page navigation with one JS call
JavaScript
35
star
32

parallax-scroller

Scroll through lists with a smooth parallax effect
JavaScript
27
star
33

flatline_icon_free

180+ high quality & minimal icons webfont for Bootstrap Framework
26
star
34

endpage_next

Navigate without moving your mouse. Pull to refresh/Hold to go next functionality on the web,
JavaScript
12
star