daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Jul 11th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.   <title>Bootstrap Example</title>
  5.   <meta charset="utf-8">
  6.   <meta name="viewport" content="width=device-width, initial-scale=1">
  7.   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  8.   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  9.   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  10. </head>
  11. <body>
  12.  
  13. <div class="container">
  14.   <h2>Progress Bar With Label</h2>
  15.   <div class="progress">
  16.     <div id="seekbarb" class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
  17.       xx
  18.     </div>
  19.   </div>
  20. </div>
  21. <script type="text/javascript">
  22. $(document).ready(function() {
  23.     var elem = document.getElementById("seekbarb");
  24.     var id = setInterval(frame, 1);
  25.     var width = 0;
  26.     var position = 5;
  27.     var length = 600;
  28.     var percent = position / length * 100;
  29.  
  30.     var add = 100/length;
  31.  
  32.     console.log("Das Lied geht "+length+ " Sekunden"); // Song länge in Sekunden
  33.     console.log("Ich bin bei "+position+ " Sekunden"); // Song position in Sekunden
  34.     console.log("Und habe schon "+percent+"% geschafft"); // Macht in dieser function keinen sinn, nur in frame()
  35.     // console.log("Ich füge zu "+percent+"% "+add+"% hinzu"); Diese Aussage ist zwecklos.
  36.  
  37.     var seekbar = parseInt(100*percent);
  38.     console.log("Die var(seekbar) = "+seekbar); // Seekbar value
  39.     function frame() {
  40.         if (seekbar >= 100) {
  41.             //Stopt bei var(seekbar) die function und ist fertig
  42.             clearInterval(id);
  43.             elem.style.width = '100%'; // Setzt bei einfach nach dem Stoppen 100%
  44.         } else {
  45.             seekbar = seekbar + add/100;
  46.             //console.log(seekbar+"% werden jetzt gesetzt")
  47.             elem.style.width = (seekbar) + '%';
  48.         }
  49.     }
  50. });
  51. </script>
  52. </body>
  53. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top