vendredi 3 avril 2015

making a gallery with display none

i'm new in js, im trying to make a hide/show img when i press a button... but it's not working can someone help me? thanks alot


function nextImgRight(){



var img1 = document.querySelector("#img01")
var img2 = document.querySelector("#img02")
var img3 = document.querySelector("#img03")
var img4 = document.querySelector("#img04")
var img5 = document.querySelector("#img05")
var img6 = document.querySelector("#img06")

if(img1.style.display="block"){
img1.style.display="none";
img2.style.display="block";
img3.style.display="none";
img4.style.display="none";
img5.style.display="none";
img6.style.display="none";}


else if(img2.style.display="block"){
img1.style.display="none";
img2.style.display="none";
img3.style.display="block";
img4.style.display="none";
img5.style.display="none";
img6.style.display="none";
}


}

Aucun commentaire:

Enregistrer un commentaire