Created
November 29, 2017 11:04
-
-
Save stockenberg/f5585255da6ccaf3e2b3858ad01697e2 to your computer and use it in GitHub Desktop.
ProgressBar
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
<!doctype html> | |
<head> | |
<title>Titel</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous"> | |
<script> | |
var initialWidth = window.innerWidth; | |
// Value in Milliseconds | |
var attrValue = 20000; | |
// 20 Sekunden | |
var duration = attrValue / 1000; | |
// Framecount | |
var frames = 60; | |
// Frames pro 20 Sekunden | |
var framesTotal = frames * duration; | |
var number = (window.innerWidth / framesTotal); | |
var interval = 1000 / frames; | |
var slider = document.getElementsByClassName('progress-bar'); | |
setInterval(function () { | |
if(number >= initialWidth){ | |
number = (window.innerWidth / framesTotal); | |
} | |
slider[0].style.width = number + "px"; | |
number += (window.innerWidth / framesTotal); | |
}, interval ); | |
</script> | |
</head> | |
<body> | |
<div class="progress"> | |
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div> | |
</div> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment