diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..e6923bb --- /dev/null +++ b/css/style.css @@ -0,0 +1,3 @@ +*{ + box-sizing: border-box; +} \ No newline at end of file diff --git a/html/index.html b/html/index.html new file mode 100644 index 0000000..bd4fbac --- /dev/null +++ b/html/index.html @@ -0,0 +1,24 @@ + + + + + + + + Whose Down For Some Kitten Pictures? + + + + +

Dont you just LOOOOVVVEEE cute Kittens?

+ +

If so, don't hesitate to click the button below!

+ +
+
+
+
+
+ + + \ No newline at end of file diff --git a/js/catPics.js b/js/catPics.js new file mode 100644 index 0000000..e861be5 --- /dev/null +++ b/js/catPics.js @@ -0,0 +1,36 @@ +document.querySelector('button').addEventListener('click', getKitty) + +function kittyKeys(){ + const key = "live_z4zUQbzc0pk87zhPzuYtSmwrud8WjQMlf3kBOIKAhDruZp5bJJRmv1aYTyDpFmFa" +} + + function getKitty(){ + const catSelector = document.querySelector('button').value + + const url = 'https://api.thecatapi.com/v1/images/search?limit=10&breed_ids=beng&api_key=live_z4zUQbzc0pk87zhPzuYtSmwrud8WjQMlf3kBOIKAhDruZp5bJJRmv1aYTyDpFmFa' + fetch(url,{headers: { + 'x-api-key': "live_z4zUQbzc0pk87zhPzuYtSmwrud8WjQMlf3kBOIKAhDruZp5bJJRmv1aYTyDpFmFa" + }}) + .then((response) => { + return response.json(); + }) + .then((data) => { + let imagesData = data; + imagesData.map(function(imageData) { + + let image = document.createElement('img'); + //use the url from the image object + image.src = `${imageData.url}`; + + let gridCell = document.createElement('div'); + gridCell.classList.add('col'); + gridCell.classList.add('col-lg'); + gridCell.appendChild(image) + + document.getElementById('grid').appendChild(gridCell); + + }); + }) + .catch(function(error) { + console.log(error); + })}; \ No newline at end of file diff --git a/js/html/css/css b/js/html/css/css new file mode 100644 index 0000000..e6923bb --- /dev/null +++ b/js/html/css/css @@ -0,0 +1,3 @@ +*{ + box-sizing: border-box; +} \ No newline at end of file