losapwild,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(function() {
var num = 19,
output = $('#mydiv'),
LS_allowed=!!(window.localStorage);
if (LS_allowed && localStorage.getItem('num')) num = +localStorage.getItem('num');
function changeNum(){
output.text(num--);
if (LS_allowed) localStorage.setItem('num',num);
//каждый раз задержка будет на 100ms больше
if(num >= 0) setTimeout(changeNum,500+(19-num)*100);
}
setTimeout(changeNum,500);
});
</script>
</head>
<body>
<div id="mydiv"></div>
</body>
</html>