From 725fdf86fcde1d35b45cf42ed3cfad7f9ec7e9ec Mon Sep 17 00:00:00 2001 From: Christian Esperar <christianesperar@gmail.com> Date: Wed, 18 Nov 2015 18:14:11 +0800 Subject: [PATCH] Fix Uncaught TypeError: Cannot read property 'style' of null when NProgress start --- production/index.html | 3 --- production/js/custom.js | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/production/index.html b/production/index.html index f418a1ed..4c202603 100755 --- a/production/index.html +++ b/production/index.html @@ -25,9 +25,6 @@ <script src="js/jquery.min.js"></script> <script src="js/nprogress.js"></script> - <script> - NProgress.start(); - </script> <!--[if lt IE 9]> <script src="../assets/js/ie8-responsive-file-warning.js"></script> diff --git a/production/js/custom.js b/production/js/custom.js index 177a8ba6..c546c29b 100755 --- a/production/js/custom.js +++ b/production/js/custom.js @@ -303,6 +303,7 @@ $(function () { }); /** ****** Accordion *********************** **/ + /** ****** scrollview *********************** **/ $(document).ready(function () { @@ -312,4 +313,16 @@ $(document).ready(function () { }); }); -/** ****** /scrollview *********************** **/ \ No newline at end of file +/** ****** /scrollview *********************** **/ + +/** ****** NProgress *********************** **/ +if (typeof NProgress != 'undefined') { + $(document).ready(function () { + NProgress.start(); + }); + + $(window).load(function () { + NProgress.done(); + }); +} +/** ****** NProgress *********************** **/ \ No newline at end of file