Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*{
box-sizing: border-box;
}
24 changes: 24 additions & 0 deletions html/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="This is where your description goes">
<meta name="keywords" content="one, two, three">

<title>Whose Down For Some Kitten Pictures?</title>
<link rel="stylesheet" href="/catPics (simple2)/css/style.css">
<!-- external CSS link -->
</head>
<body>
<h1>Dont you just LOOOOVVVEEE cute Kittens?</h1>
<img src="" alt="">
<p>If so, don't hesitate to click the button below!</p>
<button>Click!</button>
<div class="maincontent">
<div id="grid" class="imgrid"></div>
</div><div class="maincontent">
<div id="grid" class="imgrid"></div>
</div>
<iframe src="" frameborder="0"></iframe>
</body>
<script type="text/javascript" src="/catPics (simple2)/js/catPics.js"></script>
36 changes: 36 additions & 0 deletions js/catPics.js
Original file line number Diff line number Diff line change
@@ -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);
})};
3 changes: 3 additions & 0 deletions js/html/css/css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*{
box-sizing: border-box;
}