I'm looking to change the color of font based on my timer reaching <= 30 seconds. I am using this countdown plugin as my timer. So far, I am able to change the color, etc... but it adds it regardless of the time, etc. I'm fairly new to jQuery, so any help is appreciated!
$(document).ready(function(){
var seconds = $(".time-increment").val();
$("#timer").countdown({
until: +seconds,
format: 'MS',
layout: '{mn} {ml}, <span class="seconds-actual">{sn}</span> {sl} remaining',
onExpiry: reload,
onTick: checkFont
});
function reload() {
var id = $("#item-content").attr('class');
$.ajax({
type: 'POST',
url: '../modal_content.adam.php',
data: 'Qwicksale_id='+id,
success: function(msg) {
$("#item-content").hide().html(msg).fadeIn('slow');
}
});
}
});
UPDATED
I added a function for the onTick - The styled class is red all of the time, not just when seconds is less than or equal to 30?
function checkFont(seconds2) {
if(seconds2[5] == 0 && seconds2[6] <= '30') {
$('.hasCountdown').css('color', 'red');
}
}
class="seconds-actual".until: secondsno need of+there...seconds2[6] <= 30(30 as a number, not a string)?