My JSON includes some pictures. I have gotten the pictures to work when they should and when they shouldnt. With the help of a if/else in jQuery. Now what I want to do is that if a image is displayed, so will some text. I want the "foto" the be dispalyed only if a image is displayed. The code below does not work. :/
var foto = post.foto var image = post.image;
// if a image is going to be displayed
if (post.image.length >= 1){
img = '<img src="/images/' + image+'" alt="image">';
if (post.foto.length >= 1){
foto = "";
} else{
foto = "";
}
// else if a image should not be displayed
}else{
img = "";
}
Aucun commentaire:
Enregistrer un commentaire