Skip to content

Instantly share code, notes, and snippets.

@imlinus
Created December 31, 2017 03:08
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 imlinus/eb8b7f34cde25a1f6fe2fe990eea4a2d to your computer and use it in GitHub Desktop.
Save imlinus/eb8b7f34cde25a1f6fe2fe990eea4a2d to your computer and use it in GitHub Desktop.
LineLoader
<html>
<head>
<style>
.line-loader {
height: 0.25rem;
background: black;
width: 0;
position: absolute;
top: 0; left: 0;
transition: width 0.25s cubic-bezier(1.000, 0.000, 0.000, 1.000);
}
</style>
</head>
<body>
<div class="line-loader"></div>
<script type="text/javascript">
var LineLoader = {
el: document.querySelector('.line-loader'),
to: function(width) {
var el = LineLoader.el
el.style.width = width + '%'
},
}
setTimeout(() => {
LineLoader.to(30)
}, 250)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment