Create an Apple-like one page scroller website (iPhone 5S website) with One Page Scroll plugin
Create an Apple-like one page scroller website (iPhone 5S website) with One Page Scroll plugin
#One Page Scroll 1.3.1 by Pete R. Create an Apple-like one page scroll website (iPhone 5S website) with One Page Scroll plugin Created by Pete R., Founder of BucketListly
License: Attribution-ShareAlike 4.0 International
jQuery (1.9.0 or later)
note: jQuery 1.9.0 or later is strongly recommended because using jQuery less than 1.8.3 and jquery.onepage-scroll.js together turns out to be a hash-based XSS vulnerabiliry.
see: http://jsfiddle.net/33WJx/
Modern browsers such as Chrome, Firefox, and Safari on both desktop and smartphones have been tested. Should work fine on IE8 and IE9 as well.
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 the latest jQuery library together with jquery.onepage-scroll.js, onepage-scroll.css into your document's <head> and call the function as follows:
<body>
...
...
</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:
…
` 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.
You can trigger page move with hotkeys as well:
Pressing the up arrow or the page up key allows you to move the page up by one.
Pressing the down arrow or the page down key allows you to move the page down by one.
Pressing the space key allows you to move the page down by one.
Pressing the home key brings you back to the first page.
Pressing the end key brings you to the last page.
You can also trigger page move programmatically as well:
This method allows you to move the page up by one. This action is equivalent to scrolling up/swiping down.
$(".main").moveUp();
This method allows you to move the page down by one. This action is equivalent to scrolling down/swiping up.
$(".main").moveDown();
This method allows you to move to the specified page index programatically.
$(".main").moveTo(3);
You can use callbacks to perform actions before or after the page move.
This callback gets called before the plugin performs its move.
$(".main").onepage_scroll({
beforeMove: function(index) {
...
}
});
This callback gets called after the move animation was performed.
$(".main").onepage_scroll({
afterMove: function(index) {
...
}
});
If you want to see more of my plugins, visit The Pete Design, or follow me on Twitter and Github.
No open issues yet, or sync has not completed.