Mobile app version of vmapp.org
Login or Join
Goswami781

: Circular Progress Button – different times for different buttons I'm trying integrate these awesome circular buttons with my form. Everything works but I have one problem: I wanna different status

@Goswami781

Posted in: #Javascript

I'm trying integrate these awesome circular buttons with my form. Everything works but I have one problem: I wanna different status time for each button.

Here is an example: jsfiddle.net/uqgv0838/1/ I wanna that second button will have status a bit longer.

This piece of code is for status time:

UIProgressButton.prototype.options = {
// time in ms that the status (success or error will be displayed) - should be at least higher than the transition-duration value defined for the stroke-dashoffset transition of both checkmark and cross strokes
statusTime : 1500
}


How can I set this time for each button individually?

It'd be great if each status also have different types. E.g. "success" will be forever but "error" only for several seconds.

Can anyone help me?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Goswami781

1 Comments

Sorted by latest first Latest Oldest Best

 

@Mendez628

One way you can do this is by making a small change to the UIProgressButton.prototype.stop function.

You need to make sure that you


do not get rid of the statusClass class
manually set the statusTime by editing self.options.statusTime to whatever value you want it to be.


Check the edit I made here. Look at the function mentioned above.

I just changed (from the stop() function)

setTimeout( function() {
classie.remove( self.el, statusClass );
statusEl.draw(0);
self._enable();
}, self.options.statusTime );


to include an if statement and updated statusTime

if(status < 0){ // This indicates success so we do not want to remove status Class
self.options.statusTime = 5000; // Here set your statusTime based on 'status'
setTimeout( function() {
classie.remove( self.el, statusClass );
statusEl.draw(0);
self._enable();
}, self.options.statusTime );
}


To be able to have a different statusTime for each Button, what you could potentially do is set the statusTime (like I mentioned in the fiddle) based on a buttonId or a class etc.
you could have another if statement that does this.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme