Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final version - Tony and Chris #7

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
added link to photographers profile page
  • Loading branch information
tonybatty committed Sep 18, 2018
commit f694fafe749a3ea93da0ce4cb6977f11f3e0a380
5 changes: 4 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ const thumbParent = document.querySelector(".thumbs");
const photoParent = document.querySelector(".photo");
const fullSize = [];
const photographerArr = [];
const photographerProfileUrl = [];
const formParent = document.querySelector(".search");
const credits = document.querySelector("#credit-user");

@@ -33,7 +34,8 @@ function displayPhotos(body) {
thumbParent.innerHTML += `<img class="thumb" id="${index}" src="${image.urls.thumb}">`
fullSize[index] = image.urls.regular;
photographerArr[index] = image.user.name;
console.log(photographerArr);
photographerProfileUrl[index] = image.user.portfolio_url;
console.log(image.user.portfolio_url);
})
photoParent.innerHTML = `<img class="img" src="${fullSize[0]}">`
credits.textContent = photographerArr[0];
@@ -50,6 +52,7 @@ thumbParent.addEventListener('click', event => {
event.target.classList.toggle("active");
console.log(event.target.className);
credits.textContent = photographerArr[event.target.id];
credits.setAttribute('href', photographerProfileUrl[event.target.id]);

});