Dear Appery,
i'm using this function for some CSS progressBar anumation:
precode
(function( $ ){
$.fn.animateProgress = function(progress, callback) {
return this.each(function() {
$(this).animate({
width: progress+'%'
}, {
duration: 2000,
Code: Select all
easing: 'swing',
step: function( progress ){
var labelEl = $('.ui-label', this),
valueEl = $('.value', labelEl);
if (Math.ceil(progress) < 20 && $('.ui-label', this).is(":visible")) {
labelEl.hide();
}else{
if (labelEl.is(":hidden")) {
labelEl.fadeIn();
};
}
if (Math.ceil(progress) == 100) {
labelEl.text('Done');
setTimeout(function() {
labelEl.fadeOut();
}, 1000);
}else{
valueEl.text(Math.ceil(progress) + '%');
}
},
complete: function(scope, i, elem) {
if (callback) {
callback.call(this, i, elem );
};
}
});
}); };
})( jQuery );
/code/pre
when placing the above code in a JS asset file there's no problem and it's working well, however i need it to be placed inside mapping js function, if i put the same code there i get the following error:
TypeError: 'undefined' is not a function (evaluating '$('#progress_bar .ui-progress').animateProgress(n)')
can you please point me on tweak the code to work from within the mapping js code?
Many thanks in advance!
Best.
R.