Yes, that's the question I addressed with my latest CodePen . . . it's an example of multiple instances on the page, setting the percentage with a data attribute.
You noticed it's not clean js, can you change it to be as clean as possible?
Please and thank you? No? Yeah, I'll pass. You're welcome, though. I'm not saying my JS is horribly inefficient, I'm just saying I'm sure it could be better. I'm happy to lend a hand and help you get started, which I've done, but at some point you'll need to learn this stuff for yourself. I highly recommend you do a bit of Googling on the subject.
Hello!
Is there any way to change increment speed (speed of a++ or a--) in javascript?
If yes how? and where to put the code?
Thanks in advance!
Alireza.M
i'd need to see your code to know how to help you with your specific issue, but in the meantime this stackoverflow may hold your answer:
http://stackoverflow.com/questions/10586890/increment-integer-by-1-every-1-second
see also: https://developer.mozilla.org/en-US/docs/DOM/window.setInterval?redirectlocale=en-US&redirectslug=window.setInterval
no you cant do it with ++ and -- but you can do
and foo would be 8. Or for -- you could use
and foo would be 2.
Hope this is what you wanted. My JavaScript might not be right because i haven't done JavaScript in a while.
Actually I want to increase this script's speed of 0 to 100.
http://codepen.io/JoshBlackwood/pen/cqDib
What's your idea?
in that case you could only change the setInterval number to a smaller number than 100.
If the number at the end
were to be 1000, then the indicator will increment every 1000ms or every 1 second.
You can adjust the increment speed with that.
100 = 0.1s
500 = 0.5s
2000 = 2s
Yes, that's it.
Thank you Paulie! it worked.
Now, If I want to use multiple of this progress bars inside of one page what I should do?
When I put multiple progress bars in one page one of them works but the others not.
Don't....I can't think of anything more annoying.
What do you mean by saying this?
I have questions about web and will ask here because here is exactly the right place.
@AlirezaM, just change them to a class instead of id..
http://codepen.io/ChrisPlz/pen/LHJyK
What he means, is that nothing is more annoying than coming to a website, and seeing 5 of these going on at different locations of the website...
The reason of doing this is that I show my costumers different colors of these progresses.
Now, I changed those ids to classes but the problem is I want to put them different percentages but all of them works exactly like first one.
I mean I give them for example : 10% , 20%, 30% and 40% but all of them work till 10%.
Try a little something like this: http://codepen.io/JoshBlackwood/pen/cqDib
Note: This is not the cleanest of JS. I wrote this in a hurry, as a proof of concept. Use at your own risk. ;)
But if you read previous comments I could change the speed by Paulie's helps.
Now I want to use multiple progresses in one page.
Yes, that's the question I addressed with my latest CodePen . . . it's an example of multiple instances on the page, setting the percentage with a
dataattribute.Yes man.
Now it's working.
You noticed it's not clean js, can you change it to be as clean as possible?
Sheesh....do some of your own work why don't you?
Dear Paulie if I was that professional I never asked my questions here.
But if you don't try, how will you learn?
I'm really trying to learn but program languages is really hard to learn for me .
Great!
Please and thank you? No? Yeah, I'll pass. You're welcome, though. I'm not saying my JS is horribly inefficient, I'm just saying I'm sure it could be better. I'm happy to lend a hand and help you get started, which I've done, but at some point you'll need to learn this stuff for yourself. I highly recommend you do a bit of Googling on the subject.
Here are some good starting points: http://www.jameswiseman.com/blog/2010/04/20/jquery-standards-and-best-practice/ https://github.com/rwldrn/idiomatic.js http://dev.opera.com/articles/view/efficient-javascript/ http://jqfundamentals.com/
OK, I will start to learn these practices and sure I'll come back and help people like myself.
and really thank all you very much for your helps.