Forums

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

Home Forums Other Code Puzzle: How to make a perfect grid on any screen. Reply To: Code Puzzle: How to make a perfect grid on any screen.

#175919
Gary Pickles
Participant

Hi Nix, been having a look at this as something to do to learn about maths & arrays in jquery, my plan was to use prime numbers in an array to find out if the height and width have common factor which the highest one would be size of the square that would fit exactly into the browser window.

I got so far with the codepen below, this is just returning the results to the page, i’m sure i could get the results into two new arrays for height and width, but don’t know how to approach comparing them to find the highest matching and if there are no matches returning 1 as the result.

See the Pen difzv by Gary Pickles

Resize window to see it work…