Change image icon
Posted: Saturday 22 June 2019 11:17
I got a text block with Buienradar info.

I wanna also change the image icon if the text is not "Voorlopig droog". Can someone tell me how to get this done?
Thanks in advance.
Code: Select all
blocks[345] = {} //Buienradar (text)
blocks[345]['title'] = 'Buienradar';
blocks[345]['switch'] = true;
blocks[345]['width'] = 12;
blocks[345]['image'] = '../custom/img/rain-off.png';
Code: Select all
function afterGetDevices(){
// Buienradar
if (alldevices[345].Data == 'Voorlopig droog') {
$('.block_345 .col-icon').addClass('off-ico');
$('.block_345 .col-data').addClass('off-stat');
}
else {
$('.block_345 .col-icon').removeClass('off-ico');
$('.block_345 .col-data').removeClass('off-stat');
}

I wanna also change the image icon if the text is not "Voorlopig droog". Can someone tell me how to get this done?
Thanks in advance.