Created
September 19, 2012 15:59
-
-
Save rlemon/3750479 to your computer and use it in GitHub Desktop.
another css loading animation. kinda like the last.
Different colours for kicks. Choosing no colour (not possible unless you edit the HTML or js) will result in a black dot.
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
| <h1>CSS Loading</h1> | |
| <ul class="drops blue"> | |
| <li></li> | |
| <li></li> | |
| <li></li> | |
| <li></li> | |
| <li></li> | |
| </ul> | |
| <ul class="nav"> | |
| <li data-assign="pink">Toggle Pink</li> | |
| <li data-assign="blue">Toggle Blue</li> | |
| <li data-assign="green">Toggle Green</li> | |
| <li data-assign="red">Toggle Red</li> | |
| <li data-assign="yellow">Toggle Yellow</li> | |
| </ul> |
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
| $('li').on('click', function() { | |
| var drops = $('.drops'), | |
| oldClass = drops.prop('class').split(' ')[1], | |
| newClass = $(this).data('assign'); | |
| drops.toggleClass(oldClass + ' ' + newClass); | |
| }); |
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
| @import url(http://fonts.googleapis.com/css?family=Advent+Pro:700); | |
| /* Meat and potatoes */ | |
| .drops { | |
| list-style: none; | |
| position: relative; | |
| height: 10px; | |
| width: 140px; | |
| margin: 0 auto; /* center the animation */ | |
| margin-top: 40px; /* padd the top from the text */ | |
| } | |
| .drops li { | |
| position: absolute; | |
| top: 0px; | |
| height: 10px; | |
| width: 10px; | |
| background-color: black; | |
| border-radius: 5px; | |
| animation-name: loading; | |
| animation-duration: 5s; | |
| animation-timing-function: ease-in-out; | |
| animation-iteration-count: infinite; | |
| animation-direction: normal; | |
| } | |
| .drops li:nth-child(1) { | |
| left: 0px; | |
| animation-delay: 250ms; | |
| } | |
| .drops li:nth-child(2) { | |
| left: 40px; | |
| animation-delay: 500ms; | |
| } | |
| .drops li:nth-child(3) { | |
| left: 80px; | |
| animation-delay: 750ms; | |
| } | |
| .drops li:nth-child(4) { | |
| left: 120px; | |
| animation-delay: 1s; | |
| } | |
| .drops li:nth-child(5) { | |
| left: 160px; | |
| animation-delay: 1.25s; | |
| } | |
| @keyframes loading { | |
| 0% { margin-left: -3000px; } | |
| 30%,70% { margin-left: 0px; } | |
| 100% { margin-left: 3000px; } | |
| } | |
| /* Colours */ | |
| .drops.pink li { | |
| background-color: #ff55de; | |
| box-shadow: 0 0 5px #ff99de, 0 0 10px #ff99de, 0 0 15px #ff99de, 0 0 20px #ff00de, 0 0 30px #ff00de, 0 0 40px #ff00de; | |
| } | |
| .drops.blue li { | |
| background-color: #99deff; | |
| box-shadow: 0 0 5px #99afff, 0 0 10px #99afff, 0 0 15px #99afff, 0 0 20px #99afff, 0 0 30px #99afff, 0 0 40px #99afff; | |
| } | |
| .drops.green li { | |
| background-color: #99ffde; | |
| box-shadow: 0 0 5px #99ffaf, 0 0 10px #99ffaf, 0 0 15px #99ffaf, 0 0 20px #99ffaf, 0 0 30px #99ffaf, 0 0 40px #99ffaf; | |
| } | |
| .drops.red li { | |
| background-color: #ff4444; | |
| box-shadow: 0 0 5px #ff2222, 0 0 10px #ff2222, 0 0 15px #ff2222, 0 0 20px #ff2222, 0 0 30px #ff2222, 0 0 40px #ff2222; | |
| } | |
| .drops.yellow li { | |
| background-color: #ffff44; | |
| box-shadow: 0 0 5px #ffff22, 0 0 10px #ffff22, 0 0 15px #ffff22, 0 0 20px #ffff22, 0 0 30px #ffff22, 0 0 40px #ffff22; | |
| } | |
| /* Presentation */ | |
| body { | |
| background: #474747 url(http://line25.com/wp-content/uploads/2009/letterpress/demo/bg.png); | |
| padding-top: 5em; | |
| overflow: hidden; | |
| } | |
| h1, .nav li { | |
| font-family: "Advent Pro"; | |
| text-align: center; | |
| color: #222; | |
| letter-spacing: 0.15em; | |
| font-weight: 700; | |
| text-transform: uppercase; | |
| color: #222; text-shadow: 0px 2px 3px #555; | |
| } | |
| .nav { | |
| position: fixed; | |
| top: 10px; | |
| left: 10px; | |
| list-style: none; | |
| } | |
| .nav li { | |
| display: inline-block; | |
| background-color: #999999; | |
| border: 1px solid #222; | |
| border-radius: 3px; | |
| padding: 6px 12px; | |
| cursor: pointer; | |
| } | |
| .nav li:hover { | |
| background-color: white; | |
| } | |
| h1 { | |
| font-size: 2.6em; | |
| } | |
| button { | |
| padding: 6px 8px; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment