question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

progress animation with JQuery File Upload

See original GitHub issue

I’m having issues getting the widget to work with JQuery File Upload.

The progress animation starts only once the file is done uploading (regardless if the file weights 1mo or 100mo) even though JQuery File Upload is set to update the progress value every 1 or 10ms (it works fine with regular progress bars). I’ve digged into every options (animation speed, disabling the animation…) but so far I haven’t been able to solve this.

$('#avatar-progress').circleProgress({
    value: 0,
    size: 156,
    fill: { color: "#60bcff" },
    emptyFill: "#ffffff",
    thickness: 2,
    startAngle: 3.8,
});

JQuery File Upload progress options :

progressInterval: 1,
dataType: 'json',
progress: function (e, data) {
    var progress = parseInt(data.loaded / data.total, 10);
    $('#avatar-progress').circleProgress('value', progress);
}

Any thoughts on this issue ? I’m really looking forward to be able to correctly implement this progress bar. Besides this, great script.

Thanks !

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
kottenatorcommented, Apr 29, 2016

Yes, the case is correct, that’s how it’s implemented right now and maybe it’s not the best way 😦

The circle remembers that the last animation was started at 100% and finished at 0 so when you redraw it - it replays the last animation.

To make it forget the last animation, you need to override animationStartValue:

// reset the circle
$('#avatar-progress').circleProgress({
  value: 0,
  animationStartValue: 0
});

After it’s reset, you can use $('#avatar-progress').circleProgress('value', ...) again, as usual

0reactions
apatikggcommented, Apr 30, 2016

Allright I think i get it. What does (…) stand for however ?

Anyways I managed to get it work but as I thought I was finally done, something showed up.

processfail: function () {
    $('#avatar-progress').circleProgress({
                animation: { duration: 500 },
                fill: { color: "#dd3a3a" },
                animationStartValue: 0
            });
    $('#avatar-progress').circleProgress('value', 1);
    $('#avatar-progress').on('circle-animation-end', function() {
        var element = document.getElementById("avatar-progress");
        element.classList.add("avatar-pulse-error");
        setTimeout(function () {
            $('#avatar-progress').circleProgress('value', 0);
            setTimeout(function () {
                var element = document.getElementById("avatar-progress");
                element.removeAttribute("class");
                $('#avatar-progress').circleProgress({
                    animation: { duration: 10 },
                    fill: { color: "#60bcff" },
                    animationStartValue: 0
                });
            }, 500);
        }, 800);
    });
},

As you see I am using the code to run the second half of the script after the 0-100 has ended. It works very fine exept immediatly after this script is done, the part between

$('#avatar-progress').on('circle-animation-end', function() {
        // code for pulse effect
});

gets run again and again in an infinite loop of LSD effect pulse animation. Any idea why the script is doing loops ? It is supposed to run only once after the bar reaches 0->100

Thank you !

Read more comments on GitHub >

github_iconTop Results From Across the Web

File upload progress bar with jQuery - Stack Overflow
I am using jQuery for this; my code submits the data using AJAX. I also want to implement a file upload progress bar....
Read more >
jQuery Ajax Image Upload with Animating Progress Bar - Phppot
The jQuery form library is used to submit the form via AJAX with an animated progress bar. The ajaxForm() function is used to...
Read more >
How to Files Upload with Progress Bar Help of jQuery Ajax ...
File Upload Form with Progress Bar · 1. Create an HTML form with a file input field and a submit button. The <form>...
Read more >
File Upload Progress Bar Using jQuery And PHP
To Create File Upload Progress Bar it takes only four steps:- · Step 1. Make a HTML file and define markup for file...
Read more >
jQuery Ajax File Upload with Progress Bar
A file input option is used to choose the file and the file binaries are posted to the server via AJAX. After sending...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found