PluginProbe
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder / 51.1.78
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder v51.1.78
51.1.83 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 All 37 releases
king-addons / includes / features / Parallax_Background / 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.78, at includes/features/Parallax_Background/preview-handler.js

45 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 // noinspection SpellCheckingInspection
2
3 "use strict";
4 (function ($) {
5 $(window).on('elementor/frontend/init', function () {
6 let KngParallaxBackgroundHandler = elementorModules.frontend.handlers.Base.extend({
7 onInit: function onInit() {
8 if (this.$element.hasClass('kng-parallax-bg-yes')) {
9 this.applyKngParallaxBackground();
10 }
11 },
12 getReadySettings: function getReadySettings() {
13 let settings = {
14 kng_parallax_bg_image: this.getElementSettings('kng_parallax_bg_image'),
15 kng_parallax_bg_speed: this.getElementSettings('kng_parallax_bg_speed'),
16 kng_parallax_bg_type: this.getElementSettings('kng_parallax_bg_type')
17 };
18 return $.extend({}, settings);
19 },
20 onElementChange: function onElementChange() {
21 if (this.$element.hasClass('kng-parallax-bg-yes')) {
22 if (!this.$element.hasClass('kng-parallax-bg-applied')) {
23 this.applyKngParallaxBackground();
24 }
25 }
26 },
27 applyKngParallaxBackground: function applyKngParallaxBackground() {
28 let options = this.getReadySettings();
29 let element_ID = this.$element.data('id');
30 this.$element.addClass('kng-parallax-bg-applied');
31 this.$element.before('<style>.king-addons-parallax-container {position: absolute;top: 0;left: 0;width: 100%;height: 100%;z-index: -100 !important;} .jarallax div {will-change: transform;}</style>');
32 this.$element.before('<style>.kng-parallax-bg-yes {background-image: none !important;} section:not(.kng-parallax-bg-yes) .king-addons-parallax-container {display: none;}</style>');
33 this.$element.append('<div data-jarallax data-speed="' + options.kng_parallax_bg_speed + '" data-type="' + options.kng_parallax_bg_type + '" class="jarallax king-addons-parallax-container ' + 'kng-parallax-bg-' + element_ID + '" style="background-image: url(' + options.kng_parallax_bg_image.url + ');"></div>');
34 this.$element.after('<script>jarallax(document.querySelectorAll(".kng-parallax-bg-' + element_ID + '"), {});</script>');
35 }
36 });
37
38 elementorFrontend.hooks.addAction('frontend/element_ready/global', function ($scope) {
39 elementorFrontend.elementsHandler.addHandler(KngParallaxBackgroundHandler, {
40 $element: $scope
41 });
42 });
43
44 });
45 })(jQuery);