You have initialized the script twice. Here is the updated script:
jQuery(document).ready(function($) {
var $window = $(window),
win_height_padded = $window.height() * 1.1,
isTouch = Modernizr.touch;
if (isTouch) { $('.revealOnScroll').addClass('.animated'); }
$window.on('scroll', revealOnScroll);
function revealOnScroll() {
var scrolled = $window.scrollTop(),
win_height_padded = $window.height() * 1.1;
// Showed...
$(".revealOnScroll:not(.animated)").each(function () {
var $this = $(this),
offsetTop = $this.offset().top;
if (scrolled + win_height_padded > offsetTop) {
if ($this.data('timeout')) {
window.setTimeout(function(){
$this.addClass('.animated ' + $this.data('animation'));
}, parseInt($this.data('timeout'),10));
} else {
$this.addClass('.animated ' + $this.data('animation'));
}
}
});
// Hidden...
$(".revealOnScroll.animated").each(function (index) {
var $this = $(this),
offsetTop = $this.offset().top;
if (scrolled + win_height_padded < offsetTop) {
$(this).removeClass('.animated .fadeInUp .flipInX .lightSpeedIn')
}
});
}
revealOnScroll();
});
UPDATE:
This script is not working because you have used jQuery script inside Javascript which won’t work. You need to use either javascript or jQuery.
revealOnScroll() is a javascript function while .each used inside this function is a jQuery function. Please be clear whether you want to use jQuery or javascript.
UPDATE 1:
Add this script after jquery.js which you have missed.
<script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.7.2.js"></script>
Hope this helps!