Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Kris Byrum
Kris Byrum
32,636 Points

Transverse an array in jQuery/JavaScript

I'm trying to hone my jQuery/JavaScript skills and I am stuck.

I'm attempting to make an elevator control panel.

It has 4 buttons for each of the floors.

There is a display which shows what floor I am currently on.

Right now, when I click it the button lights up and the indicator arrow works properly. Both will stay on until the click event is complete and then they will go back to their default.

My problem. I can get the floor display to show the current floor and then the one I click, however, I'd like to make the floor slide up or down - floor by floor - until I have reached my destination.

I did a for loop and put the counting variable (i) into a global array.

It is printing to the console properly and in order, but I can't figure out the display.

Thanks for any help!!!

1 Answer

Jeremy Germenis
Jeremy Germenis
29,854 Points
  1. You could use CSS overflow:hidden on your floor display and have a numbered list animate up and down
  2. You could use dots to create your numbers and have each number displayed line by line