optimize jquery progress bar

optimize jquery progress bar

kudvenkat

9 лет назад

31,130 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@betaakurnia3998
@betaakurnia3998 - 09.06.2019 12:15

who is optim a

Ответить
@adnanjlassi5332
@adnanjlassi5332 - 04.01.2017 18:37

Thank you for your tutorial, it helped me a lot :)

Ответить
@braScene
@braScene - 25.07.2016 03:14

Hi, here's my three-line optimization with only one replacement in original code:

--- new part---
var currentValue = $("#innerDiv").text();
var position = (currentValue == "") ? 1 : parseInt(currentValue.substr(0, currentValue.indexOf("%")));
percentageCompleted = (position > percentageCompleted) ? --percentageCompleted : percentageCompleted;
--- new part---

After this, just change the "count" part of code, replace number "1" with "position" variable:
- old: $({ count: 1}).animate....(rest of code)
- new: $({ count: position }).animate.....(rest of code)

Thank you mr Venkat for giving us the opportunity to learn all these topic in your tutorials, and helping us to improve ourselves!

Ответить
@conaxliu9677
@conaxliu9677 - 29.08.2015 14:48

If there are multiple properties being animated (eg. width and height), it seems like 'now' only works with the last property in the JSON object. Is there anyway to get 'now' for all the properties?

Ответить
@artemboss1999
@artemboss1999 - 22.05.2015 13:01

percentages may be rounded as follows:
$('#innerDiv').text(Math.round(this.count) + ' %');
and then you do not need to subtract one value

Ответить
@boi-huela4877
@boi-huela4877 - 22.05.2015 05:01

Thank you Sir.

Ответить