mardi 23 octobre 2018

Simple Countdown 2

I am new to web development and I want to implement a countdown in my website. And I want to change the counter so that the date will be as 11 Nov 2018 3pm. What should I do?

Thanks in advance... I have simplyCountdown.js as follows:

simplyCountdown = function (elt, args) {
    var parameters = extend({
            year: 2018,
            month: 11,
            day: 11,
            hours: 15,
            minutes: 30,
            seconds: 0,
            words: {
                days: 'day',
                hours: 'hour',
                minutes: 'minute',
                seconds: 'second',
                pluralLetter: 's'
            },

    //and other calculations things here
        // Refresh immediately to prevent a Flash of Unstyled Content
        refresh();
        interval = window.setInterval(refresh, parameters.refresh);
    });
};

exports.simplyCountdown = simplyCountdown;

}(window));

and

    /*global $, jQuery, simplyCountdown*/
    if (window.jQuery) {
        (function ($, simplyCountdown) {
            'use strict';

            function simplyCountdownify(el, options) {
                simplyCountdown(el, options);
            }

            $.fn.simplyCountdown = function (options) {
                return simplyCountdownify(this.selector, options);
            };
        }(jQuery, simplyCountdown));
    }

and in the main index.html I have

    <script>
        var d = new Date(new Date().getTime() + 200 * 120 * 120 * 2000);

        // default example
        simplyCountdown('.simply-countdown-one', {
            year: d.getFullYear(),
            month: d.getMonth() + 1,
            day: d.getDate()
        });

        //jQuery example
        $('#simply-countdown-losange').simplyCountdown({
            year: d.getFullYear(),
            month: d.getMonth() + 1,
            day: d.getDate(),
            enableUtc: false
        });
    </script>




Aucun commentaire:

Enregistrer un commentaire