diff --git a/script.js b/script.js index b7fcde6..02fd6c6 100644 --- a/script.js +++ b/script.js @@ -40,7 +40,30 @@ function hash_checker(){ page_switch(val); } +function alert_offline(){ + history.replaceState(null, null, "#/"+$('ul.navbar-nav>li.active').attr('id').substr(4,)+"/"); // revert hash + var err_msg = "
You are Offline!
No network available. Check your internet connection and try again!
"; // error message in alert box + + $(``) + .appendTo('body') + .delay(7500) + .queue(function() { + $(this).alert('close'); + }); +} + function page_switch(val){ + if (!navigator.onLine){ + alert_offline(); + return; + } + $(".alert-offline").alert('close'); + $('ul.navbar-nav>li').removeClass('active'); show_loader(); $.ajax({ diff --git a/style.css b/style.css index 533fa0b..ab1e314 100644 --- a/style.css +++ b/style.css @@ -1174,3 +1174,14 @@ footer .copy{ right: 0; } } + +/** Offline alert **/ +.alert-offline{ + position:fixed; + bottom:0px; + left:50%; + transform:translateX(-50%); + margin: 0; + z-index:101; + width: 100%; +}