Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10045227
    mawiba
    Participant

    s it possible to display the countdown with just minutes and seconds only?

    When i change to
    <div class=”row”>
    <div class=”col”>
    <div class=”countdown countdown-primary” data-plugin-countdown data-plugin-options=”{‘textMin’: ‘MIN’, ‘textSec’: ‘SEC’, ‘date’: ‘2024/09/29 18:42:58’, ‘numberClass’: ‘font-weight-extra-bold’}”></div>
    </div>
    </div>

    It doesn’t work.


    #10045230
    Support
    Keymaster

    Hello, to do that you need to customize the plugin, adding this:

    (js/custom.js)

    $.extend( theme.PluginCountdown.prototype, {
    	build: function() {
    		if (!($.isFunction($.fn.countTo))) {
    			return this;
    		}
    
    		var self = this,
    			$el = this.options.wrapper,
    			numberClass = ( self.options.numberClass ) ? ' ' + self.options.numberClass : '',
    			wrapperClass = ( self.options.wrapperClass ) ? ' ' + self.options.wrapperClass : '';
    
    		if( self.options.uppercase ) {
    			$el.countdown(self.options.date).on('update.countdown', function(event) {
    				var $this = $(this).html(event.strftime(self.options.insertHTMLbefore
    					+ '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> '
    					+ '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> '
    					+ self.options.insertHTMLafter
    				));
    			});
    		} else {
    			$el.countdown(self.options.date).on('update.countdown', function(event) {
    				var $this = $(this).html(event.strftime(self.options.insertHTMLbefore
    					+ '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> '
    					+ '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> '
    					+ self.options.insertHTMLafter
    				));
    			});
    		}
    
    		return this;
    	}
    } );

Viewing 2 posts - 1 through 2 (of 2 total)