Last active
August 29, 2015 14:00
-
-
Save b0r1sp/11367401 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: http://www.bram.us/2014/01/01/skrollr-css-animations-linked-to-scroll-position/ | |
var setSkrollr = function($el, data) { | |
for (var i = 0, l = data.length; i < l; i++) { | |
var d = data[i], | |
px = d[0]; | |
css = d[1]; | |
$el.attr('data-' + px, css); | |
} | |
} | |
setSkrollr($('#example'), [[0, 'width:100%'], [1500, 'width:0%']]); | |
setSkrollr($('#example2'), [[0, 'transform:translateY(-100%)'], [1500, 'transform:translateY(100%)']]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment