(function($) {
    'use strict';

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

    sectionTitle.eltdfInitSectionTitle = eltdfInitSectionTitle;


    sectionTitle.eltdfOnDocumentReady = eltdfOnDocumentReady;

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

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

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

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

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