
jQuery('.top-banner-design').each(function(i) {
    var bottom_of_object = jQuery(this).offset().top + jQuery(this).outerHeight();
    var bottom_of_window = jQuery(window).scrollTop() + jQuery(window).height();
    if (bottom_of_window > bottom_of_object - 300) {
        jQuery(this).animate({ 'opacity': '1' }).addClass("line-animated");
    }
});
jQuery(document).ready(function() {

$('.feature-ss-section a, .insta-link').append('<span> </span>');
    $('.feature-ss-media video, #bottom-rocket').each(function() {
        var thatObj = $(this);
        thatObj.before('<img class="zalter-img" alt="" src="' + thatObj.attr('poster') + '">');
        thatObj.attr('preload', 'auto');
        thatObj.removeAttr('poster');
    });
    var _l = 600;
    var _valtop = ($('.agencies-wrap').offset().top + $('.agencies-wrap').height()) + ($(window).height() / 2.5);
    var _valendtop = ($('.agencies-wrap').offset().top + $('.agencies-wrap').height()) + ($(window).height() / 2.5) + 300;
    jQuery(window).scroll(function() {
        var _anistart = $('.move-anim').offset().top - $('.move-anim').height() - $(document).scrollTop();
        var _scrolTop = $(document).scrollTop();
        jQuery('.insta-section, .rating-section .content-wrap, .testimonial-section, .rating-section, .bottom-cta-wrap').each(function(i) {
            var bottom_of_object = jQuery(this).offset().top + jQuery(this).outerHeight();
            var bottom_of_window = jQuery(window).scrollTop() + jQuery(window).height();
            if (bottom_of_window > bottom_of_object - 300) {
                jQuery(this).animate({ 'opacity': '1' }).addClass("line-animated");
            }
        });
        var offset = $(window).scrollTop() + $(window).height() / 1.5;
        $('video').each(function() {
            var thisVid = $(this);
            var secOffset = $(this).offset().top;
            if (offset > secOffset) {
                if (!thisVid.hasClass('played')) {
                    thisVid.get(0).muted = true;
                    if (navigator.appName == 'Microsoft Internet Explorer' || !!(navigator.userAgent.match(/Trident/) || navigator.userAgent.match(/rv:11/))) {
                        thisVid.get(0).play();
                    } else {
                        thisVid.get(0).play().catch(function() {
                            $(thisVid).hide();
                            $(thisVid).siblings('.zalter-img').fadeIn();
                        });
                    }
                    thisVid.addClass('played');
                }
            }
        });


        if (_anistart < 0 && _anistart > (-($(window).height() / 3))) {
            $('.move-anim').css({ 'transform': 'translate(' + (_anistart / 2) + 'px, 0px)' });
        }
        // scroll wormen
        // console.log(_valtop, _scrolTop, _valendtop);
        if ((_valtop) < _scrolTop && _valendtop > _scrolTop) {
            //$('.move-anim').css({'transform': 'translate('+((_valtop - _scrolTop)/2)+'px, 0px)'});
        }
    });

    $('.feature-ss-table>div.feature-ss-content h3').each(function() {
        var xxx = $(this).find('span').clone();
        $(this).find('span').remove();
        $(this).before(xxx);
    });
});
