-
Notifications
You must be signed in to change notification settings - Fork 3
/
addContent.js
31 lines (27 loc) · 1.06 KB
/
addContent.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
<section class="photo-card">
<div class="img-container">
<img class="person-photo-img" src="{{photoUrl}}" />
</div>
<div class="caption">
{{caption}}
</div>
</section>
*/
function addPhotoCard(photoUrl, caption) {
var photoCardSection = document.createElement("section")
photoCardSection.classList.add("photo-card")
photoCardSection.classList.add("second-class")
photoCardSection.classList.add("third-class")
photoCardSection.classList.remove("second-class")
var imgContainerDiv = document.createElement("div")
imgContainerDiv.classList.add("img-container")
photoCardSection.appendChild(imgContainerDiv)
var personPhotoImg = document.createElement("img")
personPhotoImg.classList.add("person-photo-img")
personPhotoImg.src = photoUrl
imgContainerDiv.appendChild(personPhotoImg)
console.log("== photoCardSection:", photoCardSection)
var photoCardContainer = document.getElementById("photo-card-container")
photoCardContainer.appendChild(photoCardSection)
}