Prinzhorn /skrollr

Stand-alone parallax scrolling library for mobile (Android + iOS) and desktop. No jQuery. Just plain JavaScript (and some love).

★ 18,389⑂ 3,376👁 1⑃ 87● 776▤ 0
HTMLMITCreated 2012-03-18prinzhorn.github.io/skrollr/
+0
日增长
18,389
stars
3,376
forks
1
watchers
87
prs
776
issues
0
releases

README

Please note:
============

skrollr hasn't been under active development since about September 2014 (check out the contributions graphs on https://github.com/Prinzhorn/skrollr/graphs/contributors) and I don't have any plans for doing major changes to it. Please consider this before using skrollr in production as problems with new browser versions, especially on mobile, will most definitely surface. To be honest, mobile support always sucked (because mobile browsers are hard) and you shouldn't compromise UX for some fancy UI effects. Ever.

skrollr 0.6.30
==============

Stand-alone parallax scrolling JavaScript library for mobile (Android, iOS, etc.) and desktop in about 12k minified.

Designer friendly. No JavaScript skills needed. Just plain CSS and HTML.

_Actually, skrollr is much more than "just" parallax scrolling. It's a full-fledged scrolling animation library. In fact, you can use it and still have no parallax scrolling at all. But I wanted to sound hip and use some buzz-words. By the way, skrollr leverages HTML5 and CSS3 ;-)_

Resources
=====

Plugins
-----

 Official

 skrollr-menu - Hash navigation
 skrollr-ie - IE ) and then call skrollr.init(). Or you can place it inside the  if you want to, but make sure to call init() once the document has been loaded (e.g. jQuery's ready event or even window.onload).

html
	
	
	var s = skrollr.init();
	



If you are using require.js to structure your project, you can use skrollr as a module as well.

javascript
require(['skrollr'], function(skrollr){
	var s = skrollr.init();
});


If you're familiar with CSS, you already know the style attribute. In order to create an animation you would need several, at least two, of them. That's what skrollr does. You use the HTML5 data- attributes to define multiple sets of styles (we call each of them keyframe) and skrollr interpolates between them.

 Let's change the background-color of a div starting at 00f when the scrollbar is at the top and ending with f00 when the user scrolled 500 pixels down

html
WOOOT

View in browser

 Lessons learned

 Skrollr ensures that you can actually scroll down 500 pixels or more, even if there's not enough content. You can suppress this by using the forceHeight option.
 You can't use 00f or 0000ff. You need to use rgb or hsl and explicitly decide which color space you want because they result in different animations (HSL is much cooler most of the time). Don't worry, the IE plugin teaches IE WOOOT

View in browser

 Lessons learned

 Skrollr handles all these nasty CSS prefixes for you. Just -moz-relax and get yourself a cup of -webkit-coffee.

 Now let the rotation bounce like it were a hip-hop video

html
WOOOT

View in browser

 Lessons learned

 Skrollr allows non-linear animations. The so called easing functions can be used per-property by putting them in square brackets behind the property. There's a built-in list of easing functions (see below in the JavaScript section) and you can use your own functions by using th

Top issues

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON