<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1"/> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/> <style> #loadingholder{ width: 100%; background-color:#ddd; } #loading{ width: 0%; height:30px; background-color:#337AB7; } </style> </head> <body> <nav class="navbar navbar-default"> <div class="container-fluid"> </div> </nav> <div class="col-md-6 well"> <hr style="border-top:1px dotted #ccc;"/> <div class="col-md-8"> <div id="loadingholder"> </div> </div> </div> </body> <script type="text/javascript"> Progress(); </script> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1"/> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/> </head> <body> <nav class="navbar navbar-default"> <div class="container-fluid"> </div> </nav> <div class="col-md-6 well"> <hr style="border-top:1px dotted #ccc;"/> <div class="col-md-8"> </div> </div> </body> </html>
function Progress(){ var loading = document.getElementById('loading'); var width = 0; var interval = setInterval(Duration, 60); function Duration(){ if(width >= 100){ clearInterval(interval); window.location = 'home.html'; }else{ width++; loading.style.width = width + '%'; } } }