(function($) {
    'use strict';

    var infoBox = {};
    eltdf.modules.infoBox = infoBox;

    infoBox.eltdfInitInfoBox = eltdfInitInfoBox;
    infoBox.eltdfOnDocumentReady = eltdfOnDocumentReady;

    $(document).ready(eltdfOnDocumentReady);
	$(window).on('load', eltdfOnWindowLoad);

    /*
     All functions to be called on $(document).ready() should be in this function
     */
    function eltdfOnDocumentReady() {
        eltdfInitInfoBox();
    }
	
	/**
	 All functions to be called on $(document).ready() should be in this function
	 */
	function eltdfOnWindowLoad() {
		eltdfElementorInfoBox();
	}
	
	/**
	 * Elementor
	 */
	function eltdfElementorInfoBox() {
		$(window).on('elementor/frontend/init', function () {
			elementorFrontend.hooks.addAction('frontend/element_ready/eltdf_info_box.default', function () {
				eltdfInitInfoBox();
			});
		});
	}

    /**
     * Inti process shortcode on appear
     */
    function eltdfInitInfoBox() {
        var holder = $('.eltdf-ib');

        if(holder.length) {
            holder.each(function(){
                var thisHolder = $(this);

                thisHolder.appear(function(){
                    thisHolder.addClass('eltdf-ib-appeared');
                },{accX: 0, accY: eltdfGlobalVars.vars.eltdfElementAppearAmount});
            });
        }
    }

})(jQuery);