I am having some trouble with this code. I want have an onclick function on a div and I want to call this function. Only the 'if' section of the code works. If the #about opacity is anything other than 0.47, it still executes the 'if' code, but not the 'else'
function opacityabout() {
if ($('#about').css("opacity", "0.47")) {
$('#about').css("opacity", "1");
$('#home').css("opacity", "0.47");
$('#right').css("-webkit-transform", "rotate(180deg)");
}
else {
$('#about').css("opacity", "0.47");
$('#home').css("opacity", "1");
$('#right').css("-webkit-transform", "rotate(180deg)");
}
}
My HTML is set up like this:
<div id="right" onclick="opacityabout()"> </div>
Thanks