Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to increase or decrease increment speed in javascript?

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #42449
    AlirezaM
    Participant

    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

    #123251
    dfogge
    Participant

    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

    #123263
    AlirezaM
    Participant

    Actually I want to increase this script’s speed of 0 to 100.

    http://codepen.io/JoshBlackwood/pen/cqDib

    What’s your idea?

    #123268
    CarlRosell
    Participant

    in that case you could only change the setInterval number to a smaller number than 100.

    #123269
    Paulie_D
    Member

    If the number at the end

    }, 100);

    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

    #123295
    AlirezaM
    Participant

    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.

    #123301
    Paulie_D
    Member

    >If I want to use multiple of this progress bars inside of one page what I should do?

    Don’t….I can’t think of anything more annoying.

    #123312
    AlirezaM
    Participant

    What do you mean by saying this?

    I have questions about web and will ask here because here is exactly the right place.

    #123314
    AlirezaM
    Participant

    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%.

    #123323
    AlirezaM
    Participant

    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.

    #123327
    AlirezaM
    Participant

    Yes man.

    Now it’s working.

    You noticed it’s not clean js, can you change it to be as clean as possible?

    #123330
    Paulie_D
    Member

    Sheesh….do some of your own work why don’t you?

    #123333
    AlirezaM
    Participant

    Dear Paulie if I was that professional I never asked my questions here.

    #123334
    Paulie_D
    Member

    But if you don’t try, how will you learn?

    #123336
    AlirezaM
    Participant

    I’m really trying to learn but program languages is really hard to learn for me .

Viewing 15 posts - 1 through 15 (of 16 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.