Forums

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

Home Forums JavaScript Click only works once with top property

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #199710
    Paul_H
    Participant

    I have three divs and i want to do is this: when you click on “up” or “down”, the three divs moves at the same time respectively. In my code, this only works once, but i want that three divs move (up or down) each time you click on the words. I tried with other properties (like height, width, font-size in text) and i works perfectly, but i dont know why is not working whit the top and bottom properties.

    http://jsfiddle.net/0uhjcLrw/

    #199713
    Shikkediel
    Participant

    It’s because each click is setting the same position – nothing is added or subtracted. Something like this should work :

    Updated fiddle

    #199714
    Shikkediel
    Participant

    Shane’s solution’s much cleaner of course…

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