first commit
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
(function($) {
|
||||
$.fn.eaelProgressBar = function() {
|
||||
var $this = $(this)
|
||||
var $layout = $this.data('layout')
|
||||
var $num = $this.data('count')
|
||||
var $duration = $this.data('duration')
|
||||
|
||||
if($num > 100) {
|
||||
$num = 100;
|
||||
}
|
||||
|
||||
$this.one('inview', function() {
|
||||
if ($layout == 'line' || $layout == 'line_rainbow') {
|
||||
$('.eael-progressbar-line-fill', $this).css({
|
||||
'width': $num + '%',
|
||||
})
|
||||
} else if ($layout == 'half_circle' || $layout == 'half_circle_fill') {
|
||||
$('.eael-progressbar-circle-half', $this).css({
|
||||
'transform': 'rotate(' + ($num * 1.8) + 'deg)',
|
||||
})
|
||||
} else if ($layout == 'box') {
|
||||
$('.eael-progressbar-box-fill', $this).css({
|
||||
'height': $num + '%',
|
||||
})
|
||||
}
|
||||
|
||||
$('.eael-progressbar-count', $this).prop({
|
||||
'counter': 0
|
||||
}).animate({
|
||||
counter: $num
|
||||
}, {
|
||||
duration: $duration,
|
||||
easing: 'linear',
|
||||
step: function(counter) {
|
||||
if ($layout == 'circle' || $layout == 'circle_fill') {
|
||||
var rotate = (counter * 3.6)
|
||||
$('.eael-progressbar-circle-half-left', $this).css({
|
||||
'transform': "rotate(" + rotate + "deg)",
|
||||
})
|
||||
if (rotate > 180) {
|
||||
$('.eael-progressbar-circle-pie', $this).css({
|
||||
'clip-path': 'inset(0)'
|
||||
})
|
||||
$('.eael-progressbar-circle-half-right', $this).css({
|
||||
'visibility': 'visible'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
$(this).text(Math.ceil(counter))
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}(jQuery));
|
||||
@@ -0,0 +1 @@
|
||||
!function(l){l.fn.eaelProgressBar=function(){var a=l(this),i=a.data("layout"),e=a.data("count"),r=a.data("duration");100<e&&(e=100),a.one("inview",function(){"line"==i||"line_rainbow"==i?l(".eael-progressbar-line-fill",a).css({width:e+"%"}):"half_circle"==i||"half_circle_fill"==i?l(".eael-progressbar-circle-half",a).css({transform:"rotate("+1.8*e+"deg)"}):"box"==i&&l(".eael-progressbar-box-fill",a).css({height:e+"%"}),l(".eael-progressbar-count",a).prop({counter:0}).animate({counter:e},{duration:r,easing:"linear",step:function(e){if("circle"==i||"circle_fill"==i){var r=3.6*e;l(".eael-progressbar-circle-half-left",a).css({transform:"rotate("+r+"deg)"}),180<r&&(l(".eael-progressbar-circle-pie",a).css({"clip-path":"inset(0)"}),l(".eael-progressbar-circle-half-right",a).css({visibility:"visible"}))}l(this).text(Math.ceil(e))}})})}}(jQuery);
|
||||
Reference in New Issue
Block a user