Skip to content

Instantly share code, notes, and snippets.

@jremi
Created October 25, 2018 05:19
Show Gist options
  • Save jremi/2ae2b047bddc0765438660b4e91b735f to your computer and use it in GitHub Desktop.
Save jremi/2ae2b047bddc0765438660b4e91b735f to your computer and use it in GitHub Desktop.
Simple Vanilla JS - Dot dot dot progress loader
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Dot loader</title>
</head>
<body>
Loading<span id="dots"></span>
</body>
<script>
let dots = document.getElementById('dots');
let loader = setInterval(()=>{
if(dots.textContent === ''){dots.textContent = '.';}
else if(dots.textContent === '.'){dots.textContent = '..';}
else if(dots.textContent === '..'){dots.textContent = '...';}
else if(dots.textContent === '...'){dots.textContent = '';}
},250);
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment