# king-addons/51.1.37/includes/features/Rotating_Animation/preview-handler.js

King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder, version 51.1.37. 42 lines.

- Page: https://pluginprobe.com/plugins/king-addons/51.1.37/code/includes/features/Rotating_Animation/preview-handler.js
- Raw: https://pluginprobe.com/plugins/king-addons/51.1.37/raw/includes/features/Rotating_Animation/preview-handler.js
- Modified: 2025-10-19T12:03:58+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/king-addons/51.1.37/code/includes/features/Rotating_Animation/preview-handler.js#L10-L20`.

```javascript
"use strict";
(function ($) {
    $(window).on('elementor/frontend/init', function () {
        let KngRotatingAnimationHandler = elementorModules.frontend.handlers.Base.extend({
            onInit: function onInit() {
                if (this.$element.hasClass('kng-rotating-animation-yes')) {
                    this.applyKngRotatingAnimation();
                }
            },
            getReadySettings: function getReadySettings() {
                let settings = {
                    animation_duration: this.getElementSettings('kng_rotating_animation_duration'),
                    animation_delay: this.getElementSettings('kng_rotating_animation_delay')
                };
                return $.extend({}, settings);
            },
            onElementChange: function onElementChange() {
                if (this.$element.hasClass('kng-rotating-animation-yes')) {
                    if (!this.$element.hasClass('kng-style-rotating-animation-applied')) {
                        this.applyKngRotatingAnimation();
                    }
                }
            },
            applyKngRotatingAnimation: function applyKngRotatingAnimation() {
                let options = this.getReadySettings();
                let element_ID = this.$element.data('id');
                $('.kng-style-rotating-animation-' + element_ID).remove();
                this.$element.addClass('kng-style-rotating-animation-applied');
                this.$element.before('<style>@keyframes rotating-animation-' + element_ID + ' {0% {transform: rotate(0deg);} 100% {transform: rotate(360deg)}}' +
                    '.elementor-element-' + element_ID + '.kng-rotating-animation-yes {animation: rotating-animation-' + element_ID + ' ' + options.animation_duration + 'ms linear infinite; animation-delay: ' + options.animation_delay + 'ms;' +
                    '</style>');
            }
        });

        elementorFrontend.hooks.addAction('frontend/element_ready/global', function ($scope) {
            elementorFrontend.elementsHandler.addHandler(KngRotatingAnimationHandler, {
                $element: $scope
            });
        });

    });
})(jQuery);
```
