| 1 |
"use strict"; |
| 2 |
(function ($) { |
| 3 |
$(window).on('elementor/frontend/init', function () { |
| 4 |
// Define the custom handler for the Feature List line adjustments |
| 5 |
let FeatureListLineHandler = elementorModules.frontend.handlers.Base.extend({ |
| 6 |
onInit: function onInit() { |
| 7 |
this.adjustFeatureListLines(); |
| 8 |
$(window).resize(this.adjustFeatureListLines.bind(this)); |
| 9 |
}, |
| 10 |
|
| 11 |
adjustFeatureListLines: function adjustFeatureListLines() { |
| 12 |
let $scope = this.$element; |
| 13 |
|
| 14 |
$scope.find('.king-addons-feature-list-item:not(:last-of-type)').find('.king-addons-feature-list-icon-wrap').each(function (index) { |
| 15 |
let nextOffsetTop = $scope.find('.king-addons-feature-list-item').eq(index + 1).find('.king-addons-feature-list-icon-wrap').offset().top; |
| 16 |
let currentOffsetTop = $(this).offset().top; |
| 17 |
|
| 18 |
// Calculate the line height |
| 19 |
let lineHeight = nextOffsetTop - currentOffsetTop; |
| 20 |
|
| 21 |
// Apply the calculated height to the line |
| 22 |
$(this).find('.king-addons-feature-list-line').css('height', lineHeight + 'px'); |
| 23 |
}); |
| 24 |
} |
| 25 |
}); |
| 26 |
|
| 27 |
// Initialize the handler when the specific widget is ready in Elementor |
| 28 |
elementorFrontend.hooks.addAction('frontend/element_ready/king-addons-feature-list.default', function ($scope) { |
| 29 |
elementorFrontend.elementsHandler.addHandler(FeatureListLineHandler, { |
| 30 |
$element: $scope |
| 31 |
}); |
| 32 |
}); |
| 33 |
}); |
| 34 |
})(jQuery); |