(function ($) {
	"use strict";
	var WidgetPostImage = function ($scope, $) {
			var bgcontent = $scope.find( '.ec-post-image-wrapper.ec-post-background' ).eq( 0 );
		if ($scope.find( '.ec-post-image-wrapper.ec-post-background' ).length > 0) {
			var $bgon = $scope.find( '.ec-post-image-wrapper.ec-post-background' ).data( 'bgon' );
			if ($bgon != '' && $bgon != undefined) {
				if ($bgon == 'container') {
					bgcontent.closest( '.e-con' ).prepend( bgcontent );
				} else if ($bgon == 'section') {
					bgcontent.closest( 'section.elementor-element.elementor-top-section' ).prepend( bgcontent );
				} else if ($bgon == 'innersection') {
					bgcontent.closest( 'section.elementor-element.elementor-inner-section' ).prepend( bgcontent );
				} else if ($bgon == 'column') {
					bgcontent.closest( '.elementor-column' ).prepend( bgcontent );
				}
			}
		}
	};
	$( window ).on(
		'elementor/frontend/init',
		function () {
			elementorFrontend.hooks.addAction( 'frontend/element_ready/ecafe-post-image.default', WidgetPostImage );
		}
	);
})( jQuery );