Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function once(fn, context) {
- var result;
- return function() {
- if(fn) {
- result = fn.apply(context || this, arguments);
- fn = null;
- }
- return result;
- };
- }
- var splits = new Array($(".split").length);
- $('.split').each(function(i, obj) {
- $(this).addClass('split' + i);
- splits[i] = once(function() {
- fadeInText(".split"+i);
- })
- });
- $(window).scroll(function() {
- for ( var i = 0; i <= $(".split").length; i++) {
- if ($(this).scrollTop() + $(window).height() > $(".split" + i).offset().top) {
- splits[i]();
- }
- }
- });
Add Comment
Please, Sign In to add comment