Horje
next day 2pm delivery countdown timer script Code Example
next day 2pm delivery countdown timer script
if (document.getElementById('countdownTimer')) {
    pad = function(n, len) { // leading 0's
        var s = n.toString();
        return (new Array( (len - s.length + 1) ).join('0')) + s;
    };

    var timerRunning = setInterval(

        function countDown() {
            var target = 15; // 15:00hrs is the cut-off point
            var now = new Date();

            //Put this in a variable for convenience
            var weekday = now.getDay();

            if(weekday == 0){//Sunday? Add 24hrs
                target += 24;
            }

            if(weekday == 6){//It's Saturday? Add 48hrs
                target += 48;
            }

            //If between Monday and Friday, 
            //check if we're past the target hours, 
            //and if we are, abort.
            if((weekday>=1) && (weekday<=5)){
                if (now.getHours() > target) { //stop the clock
                    return 0;
                }                
            }

            var hrs = (target - 1) - now.getHours();
            if (hrs < 0) hrs = 0;
            var mins = 59 - now.getMinutes();
            if (mins < 0) mins = 0;
            var secs = 59 - now.getSeconds();
            if (secs < 0) secs = 0;

            var str = pad(hrs, 2) + ':' + pad(mins, 2) + '.<small>' + pad(secs, 2) + '</small>';
            document.getElementById('countdownTimer').innerHTML = str;

        }, 1000
    );
}




Css

Related
easyui datagrid header font size Code Example easyui datagrid header font size Code Example
twig language name Code Example twig language name Code Example
css match nth grandchild Code Example css match nth grandchild Code Example
bootstrap-navbar-containers Code Example bootstrap-navbar-containers Code Example
when grepper whas created Code Example when grepper whas created Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
13