| 1 |
(function(){ |
| 2 |
(function($, elementor) { |
| 3 |
"use strict"; |
| 4 |
function animatedProgressbar(id, type, value, strokeColor, trailColor, strokeWidth, strokeTrailWidth) { |
| 5 |
var triggerClass = ".jltma-progress-bar-" + id; |
| 6 |
if ("line" == type) { |
| 7 |
new ldBar(triggerClass, { |
| 8 |
"type": "stroke", |
| 9 |
"path": "M0 10L100 10", |
| 10 |
"aspect-ratio": "none", |
| 11 |
"stroke": strokeColor, |
| 12 |
"stroke-trail": trailColor, |
| 13 |
"stroke-width": strokeWidth, |
| 14 |
"stroke-trail-width": strokeTrailWidth |
| 15 |
}).set(value); |
| 16 |
} |
| 17 |
if ("line-bubble" == type) { |
| 18 |
new ldBar(triggerClass, { |
| 19 |
"type": "stroke", |
| 20 |
"path": "M0 10L100 10", |
| 21 |
"aspect-ratio": "none", |
| 22 |
"stroke": strokeColor, |
| 23 |
"stroke-trail": trailColor, |
| 24 |
"stroke-width": strokeWidth, |
| 25 |
"stroke-trail-width": strokeTrailWidth |
| 26 |
}).set(value); |
| 27 |
jQuery(jQuery(".jltma-progress-bar-" + id).find(".ldBar-label")).animate({ |
| 28 |
left: value + "%" |
| 29 |
}, 1e3, "swing"); |
| 30 |
} |
| 31 |
if ("circle" == type) { |
| 32 |
new ldBar(triggerClass, { |
| 33 |
"type": "stroke", |
| 34 |
"path": "M50 10A40 40 0 0 1 50 90A40 40 0 0 1 50 10", |
| 35 |
"stroke-dir": "normal", |
| 36 |
"stroke": strokeColor, |
| 37 |
"stroke-trail": trailColor, |
| 38 |
"stroke-width": strokeWidth, |
| 39 |
"stroke-trail-width": strokeTrailWidth |
| 40 |
}).set(value); |
| 41 |
} |
| 42 |
if ("fan" == type) { |
| 43 |
new ldBar(triggerClass, { |
| 44 |
"type": "stroke", |
| 45 |
"path": "M10 90A40 40 0 0 1 90 90", |
| 46 |
"stroke": strokeColor, |
| 47 |
"stroke-trail": trailColor, |
| 48 |
"stroke-width": strokeWidth, |
| 49 |
"stroke-trail-width": strokeTrailWidth |
| 50 |
}).set(value); |
| 51 |
} |
| 52 |
} |
| 53 |
var JLTMA_ProgressBar = function($scope, $2) { |
| 54 |
var id = $scope.data("id"), $progressBarWrapper = $scope.find(".jltma-progress-bar-" + id), type = $progressBarWrapper.data("type"), value = $progressBarWrapper.data("progress-bar-value"), strokeWidth = $progressBarWrapper.data("progress-bar-stroke-width"), strokeTrailWidth = $progressBarWrapper.data("progress-bar-stroke-trail-width"), color = $progressBarWrapper.data("stroke-color"), trailColor = $progressBarWrapper.data("stroke-trail-color"); |
| 55 |
$progressBarWrapper.find("svg").remove(); |
| 56 |
$progressBarWrapper.find(".ldBar-label").remove(); |
| 57 |
$progressBarWrapper.removeClass("ldBar"); |
| 58 |
animatedProgressbar(id, type, value, color, trailColor, strokeWidth, strokeTrailWidth); |
| 59 |
}; |
| 60 |
$(window).on("elementor/frontend/init", function() { |
| 61 |
elementorFrontend.hooks.addAction("frontend/element_ready/ma-progressbar.default", JLTMA_ProgressBar); |
| 62 |
}); |
| 63 |
})(jQuery, window.elementorFrontend); |
| 64 |
})(); |
| 65 |
|