Erste Null bei Tage entfernen (CSS)

Das Divi Countdown Timer Feld “Tage” hat drei Nullen und keine eingebaute Option zum Ändern oder Entfernen des Feldes. In dieser Anleitung erfährst du, wie du die führende Null im Countdown-Modul entfernst.

Das Modul Countdown Timer fügt einen animierten Timer hinzu, der bis zu einem bestimmten Datum herunterzählt. Dieser kann für Landing Pages, für Seiten im Wartungsmodus und zur Erzeugung von zeitlich begrenzten Angeboten auf einer Verkaufsseite verwendet werden.

Die einfachste Methode, um die erste führende Null zu entfernen

.et_pb_countdown_timer .section.days p.value:first-letter {    
font-size: 0px;   
vertical-align: top 
}

Erste Null bei Tage entfernen (jQuery)

Mit folgendem Code wird die erste führende Null im Countdown-Timer-Modul von Divi entfernt.

<script>
jQuery(function($){
	
	var olddays = $('.et_pb_countdown_timer .days .value');
	
	// Clone the days and hide the original. 
	// - Wraps new days element in a span to prevent Divi from updating it
	olddays.each(function(){
		var oldday = $(this);
		oldday.after(oldday.clone());
		oldday.next().wrap('<span></span>');
	}).hide();
	
	// Update the clone each second, removing the trailing zero
	(function update_days() {
		olddays.each(function(){
			var oldday = $(this);
			var days = oldday.html();
			if (days.substr(0,1) == '0') { days = days.slice(1); }
			oldday.next().find('.value').html(days);
		});
		setTimeout(function(){ update_days(); }, 100);
	})()

});
</script>

Alle führenden Nullen entfernen (jQuery)

Mit folgendem Code werden alle führenden Nullen im Countdown-Timer von Divi entfernt.

<script>
jQuery(function($){
	
	var oldvals = $('.et_pb_countdown_timer .value');
	
	// Clone the vals and hide the original. 
	// - Wraps new vals element in a span to prevent Divi from updating them
	oldvals.each(function(){
		$(this).after($(this).clone()).next().wrap('<span></span>');
	}).hide();
	
	// Update the clones each second, removing the trailing zeros
	setInterval(function () {
		oldvals.each(function(){
			var oldval = $(this);
			var val = oldval.html();
			val = trim_leading_zeros(val);
			oldval.next().find('.value').html(val);
		});
	}, 250);
	
	function trim_leading_zeros(str) {
		if ((str.length > 1) && (str.substr(0,1) === '0')) {
			return trim_leading_zeros(str.slice(1));
		}
		return str;
	}

});
</script>

Sekundenzahl und Sekunden-Text entfernen (CSS)

Mit folgendem Code werden die Sekunden im Countdown-Timer von Divi entfernt.

.et_pb_countdown_timer .section.seconds,
.et_pb_countdown_timer .sep {
display:none;
}

Stunden-, Minuten- und Sekundenzahlen entfernen (CSS)

Mit folgendem Code werden die Sekunden im Countdown-Timer von Divi entfernt.

.et_pb_countdown_timer .section.hours,
.et_pb_countdown_timer .section.minutes,
.et_pb_countdown_timer .section.seconds,
.et_pb_countdown_timer .sep {
display:none;
}

Themen