PluginProbe
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder / 51.1.81
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder v51.1.81
51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 51.1.46 51.1.47 51.1.49 51.1.51 All 36 releases
king-addons / includes / features / Custom_CSS / preview-handler.js

preview-handler.js in King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder 51.1.81, at includes/features/Custom_CSS/preview-handler.js

39 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 "use strict";
2 (function ($) {
3 $(window).on('elementor/frontend/init', function () {
4 let KngCustomCSSHandler = elementorModules.frontend.handlers.Base.extend({
5 onInit: function onInit() {
6 if (this.$element.hasClass('kng-custom-css-yes')) {
7 this.applyKngCustomCSS();
8 }
9 },
10 getReadySettings: function getReadySettings() {
11 let settings = {
12 kng_custom_css: this.getElementSettings('kng_custom_css')
13 };
14 return $.extend({}, settings);
15 },
16 onElementChange: function onElementChange() {
17 if (this.$element.hasClass('kng-custom-css-yes')) {
18 this.applyKngCustomCSS();
19 } else {
20 let element_ID = this.$element.data('id');
21 $('.kng-custom-css-' + element_ID).remove();
22 }
23 },
24 applyKngCustomCSS: function applyKngCustomCSS() {
25 let options = this.getReadySettings();
26 let element_ID = this.$element.data('id');
27 $('.kng-custom-css-' + element_ID).remove();
28 this.$element.before('<style class="kng-custom-css-' + element_ID + '">' + options.kng_custom_css.replace("[current-element]", '.elementor-element-' + element_ID) + '</style>');
29 }
30 });
31
32 elementorFrontend.hooks.addAction('frontend/element_ready/global', function ($scope) {
33 elementorFrontend.elementsHandler.addHandler(KngCustomCSSHandler, {
34 $element: $scope
35 });
36 });
37
38 });
39 })(jQuery);