Max Headroom

JavaScript

jQuery(document).ready(function ($) {
    var headroomDone = false;
    var iPath = site.cdnUploadsPath + "/manual";
    site.preloadImages([iPath + '/headroom-1.jpg', iPath + '/headroom-2.jpg', iPath + '/headroom-3.jpg']);
    var staticBurst = function () {
        $("#headroom-static").show().startStatic(site.cdnThemePath + "/images/static8.jpg", 948, 960);
    };
    var fullScreenHeadroom = function (number) {
        $("#headroom-static").stopStatic().css({
            backgroundSize: 'cover',
            backgroundPosition: 'center center',
            backgroundImage: "url('" + iPath + "/headroom-" + number + ".jpg')"
        });
    };
    var headroomInvasion = function (step, delay) {
        var steps = [function () {
            staticBurst();
            headroomInvasion(step + 1, 400);
        }, function () {
            $("#headroom-static").hide().stopStatic();
            headroomInvasion(step + 1, 200);
        }, function () {
            staticBurst();
            headroomInvasion(step + 1, 400);
        }, function () {
            fullScreenHeadroom(1);
            headroomInvasion(step + 1, 300);
        }, function () {
            staticBurst();
            headroomInvasion(step + 1, 200);
        }, function () {
            fullScreenHeadroom(2);
            headroomInvasion(step + 1, 500);
        }, function () {
            fullScreenHeadroom(3);
            headroomInvasion(step + 1, 500);
        }, function () {
            staticBurst();
            headroomInvasion(step + 1, 200);
        }, function () {
            $("#headroom-static").hide().stopStatic();
            headroomInvasion(step + 1, 700);
        }];
        if (step < steps.length) {
            setTimeout(steps[step], delay);
        }
    };
    $(window).scroll(function () {
        if (headroomDone == true) {
            return;
        }
        var $trigger = $(".authorBlurb");
        var viewTop = $(window).scrollTop();
        var viewBottom = viewTop...