-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.js
25 lines (23 loc) · 911 Bytes
/
index.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
// code below this line
/*function showSmallPic (){
console.log("http://fillmurray.com/100/100");
let picElement= document.querySelector("p img");
picElement.src="http://fillmurray.com/100/100";
}*/
function showPicSize (event){
let button = event.target;
let whereThePictureGoes = document.querySelector("p img");
let size = button.dataset.size;
whereThePictureGoes.src = "http://fillmurray.com/"+size+"/"+size;
/* console.log( "http://fillmurray.com/400/400");
let picElement= document.querySelector("p img");
picElement.src="http://fillmurray.com/400/400";*/
}
let sizeButtons= document.querySelectorAll("ul button");
//smallPic.addEventListener("click", showSmallPic);
for (let i=0; i < sizeButtons.length; i++){
let button = sizeButtons[i];
button.addEventListener("click", showPicSize);
}
//let bigPic= document.querySelector(".larger");
//bigPic.addEventListener("click", showBigPic);