I was wondering why my 2nd condition in my code isn't working. The 1st condition is working just fine. As you can see my condition is when the opacity of the element is set to 1 then it will change to zero after clicking the button I've assigned and vice versa for the second statement.
$(function (){
if($(".show-hide").css("opacity")==="0"){
set1();
}
else if($(".show-hide").css("opacity")==="1"){
set2();
}
});
function set1(){
$(".share").on("click",function(){
$(".show-hide").css("opacity","1")
});
}
function set2(){
$(".share").on("click",function(){
$(".show-hide").css("opacity","0")
});
}
Aucun commentaire:
Enregistrer un commentaire