ability to add more images to the page if the user want to get more images

pull/118/head
omaranBazna 3 years ago
parent 7aafbefc2b
commit 8943ab6597

@ -9,7 +9,7 @@
<body>
<h1>Random Image Feed</h1>
<div class="container"></div>
<button onclick="searchagain()"> More</button>
<script src="script.js"></script>
</body>
</html>

@ -14,4 +14,12 @@ function getRandomSize() {
function getRandomNr() {
return Math.floor(Math.random() * 10) + 300
}
function searchagain(){
for(let i = 0; i < rows * 3; i++) {
const img = document.createElement('img')
img.src = `${unsplashURL}${getRandomSize()}`
container.appendChild(img)
}
}

@ -34,3 +34,11 @@ body {
width: 300px;
max-width: 100%;
}
button{
background:rgb(98, 219, 142);
border:2px solid rgb(94, 161, 123);
border-radius:25px;
padding:20px;
font-size:25px;
color:white;
}
Loading…
Cancel
Save