Last Updated: February 25, 2016
·
342
· garik

js html animation

function ik_enableScrollAnimations(t) {
    t = t || window, $(t).on("scroll", $(function() {
        $(".animate").each(function() {
            if ($(this).data("scrollAnimation") !== !1) {
                var e = $(this).closest(".container").parent();
                e.length || (e = $(this).parent());
                var n = $(t).height(),
                    i = $(t).scrollTop(),
                    r = 0;
                e.data("animate-offset") && (r = e.data("animate-offset"));
                var o = e.offset().top;
                "string" == typeof t && (o += i), i + n >= o + r && $(this).addClass("in")
            }
        })
    }, 0)), $(window).load(function() {
        $(t).trigger("scroll")
    })
}