Skip to content

Instantly share code, notes, and snippets.

@Ademking
Last active July 20, 2018 03:13
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 Ademking/b50911e6d8a174a1664597f3ce88a3f7 to your computer and use it in GitHub Desktop.
Save Ademking/b50911e6d8a174a1664597f3ce88a3f7 to your computer and use it in GitHub Desktop.
🌐 WEB : Progress bar while page loading

Visit https://github.com/usablica/progress.js for more info

  1. load css and js
<html>
<head>
... load css and js
</head>
<script>
 
        progressJs().start();
 
        if(window.attachEvent) {
            window.attachEvent('onload', function(){ progressJs().end(); });
        } else {
            if(window.onload) {
                var curronload = window.onload;
                var newonload = function() {
                    curronload();
                    progressJs().end();
                };
                window.onload = newonload;
            } else {
                window.onload = function(){ progressJs().end(); };
            }
        }
        
</script>
</html>
  1. that's it!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment