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 trialJoseph Bertino
Full Stack JavaScript Techdegree Student 14,652 PointsComputing the offset for HTML Token's `top`
It seems like the formula to compute the offset value for the HTML top
attribute should be incomplete.
(target.y * target.diameter)
Since the player's token starts above the game board, shouldn't we also be including a default offset value? (looks like it would be equal to about half the height of a Space).
1 Answer
Courtney Wilson
8,031 PointsI know this is old, but just answering for anyone who might have this same question.
The token's 'top' value starts off at '-50'. If you set it to '0', it will fit the first space. Using the target space's 'y' value is like using the row number and the first row is numbered '0'. So for the first space, you get '0' multiplied by the diameter (76) which equals '0', filling the first space.