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

JavaScript

Scott Junner
Scott Junner
9,010 Points

An offering to the JavaScript Gods

Hey. Thought you might like a little thing I wrote just as a self learning exercise. It's a one page website with a script that creates a grid of squares on the page.

Code can be found at https://github.com/HologramOfMe/gridscript

Enjoy :)

1 Answer

I Dilate
I Dilate
3,983 Points

Just grabbed it from GitHub. That's a really good application of your learning there Scott, awesome work!

One problem that's occurring though. I can't actually spot what's causing this (presumably its a CSS issue rather than JS anyway), but when I enter a larger number of squares, some of them end up falling out of their container!

Here's a screenshot at 94 squares... https://imgur.com/a/YcyoY

And 54 squares... https://imgur.com/a/2jts1

Scott Junner
Scott Junner
9,010 Points

OK yeah. Hmmm... 94 squares hey? Probably something to do with multiples of the squareHeight. Thanks for your eyes. That's valuable.

Scott Junner
Scott Junner
9,010 Points

Found it. Yep, it was in the equation determining the height of the grid container div, slowly eroding away the higher the multiple of squares in the grid. Latest commit shows the change.