| 1 |
(function(){ |
| 2 |
(function($, elementor) { |
| 3 |
"use strict"; |
| 4 |
function isElementorEditor() { |
| 5 |
return typeof elementorFrontend !== "undefined" && elementorFrontend.isEditMode(); |
| 6 |
} |
| 7 |
var JLTMA_ParticlesBG = function($scope, $2) { |
| 8 |
if ($scope.hasClass("jltma-particle-yes") || $scope.attr("data-jltma-particle") || $scope.find(".jltma-particle-wrapper").attr("data-jltma-particles-editor")) { |
| 9 |
let element_type = $scope.data("element_type"); |
| 10 |
let sectionID = encodeURIComponent($scope.data("id")); |
| 11 |
let particlesJSON; |
| 12 |
if (!isElementorEditor()) { |
| 13 |
particlesJSON = $scope.attr("data-jltma-particle"); |
| 14 |
} else { |
| 15 |
particlesJSON = $scope.find(".jltma-particle-wrapper").attr("data-jltma-particles-editor"); |
| 16 |
} |
| 17 |
if (("section" === element_type || "column" === element_type || "container" === element_type) && particlesJSON) { |
| 18 |
if (!isElementorEditor()) { |
| 19 |
$scope.prepend('<div class="jltma-particle-wrapper" id="jltma-particle-' + sectionID + '"></div>'); |
| 20 |
try { |
| 21 |
let parsedData = JSON.parse(particlesJSON); |
| 22 |
particlesJS("jltma-particle-" + sectionID, parsedData); |
| 23 |
setTimeout(function() { |
| 24 |
window.dispatchEvent(new Event("resize")); |
| 25 |
}, 500); |
| 26 |
setTimeout(function() { |
| 27 |
window.dispatchEvent(new Event("resize")); |
| 28 |
}, 1500); |
| 29 |
} catch (e) { |
| 30 |
} |
| 31 |
} else { |
| 32 |
if ($scope.hasClass("jltma-particle-yes")) { |
| 33 |
try { |
| 34 |
let parsedData = JSON.parse(particlesJSON); |
| 35 |
particlesJS("jltma-particle-" + sectionID, parsedData); |
| 36 |
$scope.find(".elementor-column").css("z-index", 9); |
| 37 |
setTimeout(function() { |
| 38 |
window.dispatchEvent(new Event("resize")); |
| 39 |
}, 500); |
| 40 |
setTimeout(function() { |
| 41 |
window.dispatchEvent(new Event("resize")); |
| 42 |
}, 1500); |
| 43 |
} catch (e) { |
| 44 |
} |
| 45 |
} else { |
| 46 |
$scope.find(".jltma-particle-wrapper").remove(); |
| 47 |
} |
| 48 |
} |
| 49 |
} |
| 50 |
} |
| 51 |
}; |
| 52 |
$(window).on("elementor/frontend/init", function() { |
| 53 |
elementorFrontend.hooks.addAction("frontend/element_ready/global", JLTMA_ParticlesBG); |
| 54 |
elementorFrontend.hooks.addAction("frontend/element_ready/container", JLTMA_ParticlesBG); |
| 55 |
}); |
| 56 |
})(jQuery, window.elementorFrontend); |
| 57 |
})(); |
| 58 |
|