Created
July 12, 2014 06:26
-
-
Save hems/b8b14f2f86b5fe35f3d1 to your computer and use it in GitHub Desktop.
creates squares over a site and fade them when you drag your mouse over it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d = | |
w: $(window).width() | |
h: $(window).height() | |
sq = 100 | |
create = (x, y) -> | |
dom = undefined | |
dom = $("<div>") | |
dom.css | |
width: sq | |
height: sq | |
position: "absolute" | |
top: (y * sq) + "px" | |
left: (x * sq) + "px" | |
"background-color": "black" | |
dom.mouseover -> | |
$( @ ).animate { | |
opacity: 0 | |
width: 0 | |
height: 0 | |
}, 1000 | |
$("body").append dom | |
x = 0 | |
while x * sq < d.w | |
y = 0 | |
while y * sq < d.h | |
create x, y | |
y++ | |
x++ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment