Last active
December 27, 2015 23:19
-
-
Save mobeets/7405170 to your computer and use it in GitHub Desktop.
Render words in two single-quotes with a GIF-like shadow dance.
This file contains 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
$(document).ready(function(){ | |
var isNotDancing = true; | |
function makeItDance() { | |
$(".quoted").animate({ top: "0%"}, 300, 'linear', function() { | |
$(this).css("top", "0%"); // dummy animation...i.e. shameless hack | |
if (isNotDancing){ | |
$('.quoted').addClass("dancing"); | |
isNotDancing = false; | |
} | |
else { | |
$('.quoted').removeClass("dancing"); | |
isNotDancing = true; | |
} | |
makeItDance(); | |
}); | |
} | |
var regex = /\'\'([^\'\']+)\'\'/g; | |
$("body *").html(function(i, val) { | |
return val.replace(regex, "<span class='quoted normal'>$1</span>") | |
}).promise().done(function(){ | |
makeItDance(); | |
}); | |
}); |
This file contains 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
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="styles.css"/> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script src="dance.js"></script> | |
</head> | |
<body> | |
<div> | |
Add two single quotes around a ''word'' or ''multiple words'' inside a div to make it dance. | |
</div> | |
(Or, wrap the word in a span with the class <span class="quoted normal">quoted normal</span>.) | |
</body> | |
</html> |
This file contains 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
.quoted{ | |
-webkit-transition: all 0.5s ease; | |
-moz-transition: all 0.5s ease; | |
-o-transition: all 0.5s ease; | |
transition: all 0.5s ease; | |
} | |
.normal{ | |
color: black; | |
} | |
.dancing{ | |
color: gray; | |
text-shadow:0px 0px 0 rgb(230,230,230),1px 1px 0 rgb(215,215,215), 2px 2px 0 rgb(200,200,200),3px 3px 2px rgba(0,0,0,0),3px 3px 1px rgba(0,0,0,0.5),0px 0px 2px rgba(0,0,0,.2); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment