Day 6 – Secret of the World

Yes! I made it! I’m back up to speed, thanks to a super fun and simple project in the final hours of the day. Once again, thanks boyfriend for the funny idea; A button that says “click here to get all the secrets of the world” and when you hover, it moves to a random location on the page. Buuuuut IF you succeed in pressing it, you will have the secret answered by a very cute puppy!

Click here and see if you can find the secret!

And I learned:

  • Again, I used the Math.random() function (will need to try something new soon) to set a random top and left position of the button.
  • In order for the button to stay on the page and not go off screen, we figured out that we could use .innerHeight and .innerWidth to figure out what the max top and left position could be. I subtracted the height and width of the button.
  • I learned how to link to a page using jQuery/JavaScript, but I don’t know if I will use it in the future, I like the a tag a bit better. But now I know!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s