Skip to content

Instantly share code, notes, and snippets.

@kaiinui
Created May 31, 2014 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaiinui/7d4e13ca1ca835e23771 to your computer and use it in GitHub Desktop.
Save kaiinui/7d4e13ca1ca835e23771 to your computer and use it in GitHub Desktop.
Medium/Youtube style simple loader css
#l{
width:100%;
height:2px;
position:fixed;
top:0;
left:0;
z-index:80;
background:red;
animation:lk .95s linear 0 infinite;
-webkit-animation:lk .95s linear 0 infinite;
transform-origin:right 0 0;
-webkit-transform-origin:right 0 0;
transform:translateX(-100%);
-webkit-transform:translateX(-100%);
}
@-webkit-keyframes lk {
50%{-webkit-transform:translateX(0);}
to{-webkit-transform:scaleX(0.01);}
}
@keyframes lk {
50%{transform:translateX(0);}
to{transform:scaleX(0.01);}
}
@kaiinui
Copy link
Author

kaiinui commented May 31, 2014

Just put div#l to html to show

to handle the loader, just manipulate it with .show() and .hide()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment