I have a simple logic issue whereby I am try to show/hide elements depending on a variable who's value is taken from a query string. The getting of the value works as I have managed to echo the var to the console. The trouble i'm having seems to be with my if statements below. Can someone tell me what i'm doing wrong please?
JQUERY...
if ($tree_option = 'smell') {
console.log(tree_option);
$('.option').addClass('off');
$('.option-2').removeClass('off');
}
else if ($tree_option = 'bushiness') {
console.log(tree_option);
$('.option').addClass('off');
$('.option-1').removeClass('off');
}
else if ($tree_option = 'needle-retention') {
console.log(tree_option);
$('.option').addClass('off');
$('.option-3').removeClass('off');
}
html...
<button class="small-12 large-4 button option option-3 text-center" data-question="needle-retention"><div class="circle-container"><img src="<?php echo get_template_directory_uri(); ?>/assets/images/tree3.png"></div><div class="">Needle Retention</div></button>
<button class="small-12 large-4 button option option-1 text-center" data-question="bushiness"><div class="circle-container"><img src="<?php echo get_template_directory_uri(); ?>/assets/images/tree1.png"></div><div class="">Bushiness</div></button>
<button class="small-12 large-4 button option option-2 text-center" data-question="smell"><div class="circle-container"><img src="<?php echo get_template_directory_uri(); ?>/assets/images/tree2.png"></div><div class="">Smell</div></button>
Aucun commentaire:
Enregistrer un commentaire