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

Added a Image Galary Project #2051

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions Mini-Projects/Javascript/Image Gallery Project/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Gallery</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<div class="gallery-wrap">
<img src="./images/back.png" alt="Back icon - image" id="backBtn">
<div class="gallery">
<div>
<span><img src="./images/image-1.png" alt="Image of a person"></span>
<span><img src="./images/image-2.png" alt="Image of a person"></span>
<span><img src="./images/image-3.png" alt="Image of a person"></span>
</div>
<div>
<span><img src="./images/image-4.png" alt="Image of a person"></span>
<span><img src="./images/image-5.png" alt="Image of a person"></span>
<span><img src="./images/image-6.png" alt="Image of a person"></span>
</div>
</div>

<img src="./images/next.png" alt="Next icon - image" id="nextBtn">
</div>


<script src="./script.js"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions Mini-Projects/Javascript/Image Gallery Project/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
let scrollContainer = document.querySelector(".gallery");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

let backBtn = document.getElementById("backBtn");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

let nextBtn = document.getElementById("nextBtn");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).


scrollContainer.addEventListener("wheel", (event) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

event.preventDefault();
scrollContainer.scrollLeft += event.deltaY;
scrollContainer.computedStyleMap.scrollBehavior='auto';

});

nextBtn.addEventListener("click", () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

scrollContainer.style.scrollBehavior='smooth';
scrollContainer.scrollLeft += 900;
});

backBtn.addEventListener("click", () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

scrollContainer.style.scrollBehavior='smooth';
scrollContainer.scrollLeft -= 900;
});
56 changes: 56 additions & 0 deletions Mini-Projects/Javascript/Image Gallery Project/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
* {
margin: 0;
padding: 0;
font-family: 'Poppins', sans-serif;
box-sizing: border-box;
}

body {
background: rgb(26, 163, 115);
}

.gallery {
width: 900px;
display: flex;
overflow-x: scroll;
}

.gallery div {
width: 100%;
display: grid;
grid-template-columns: auto auto auto;
grid-gap: 20px;
padding: 10px;
flex: none;
}

.gallery div img {
width: 100%;
filter: grayscale(100%);
transition: transform 0.5s;

}

.gallery::-webkit-scrollbar {
display: none;
}

.gallery-wrap {
display: flex;
align-items: center;
justify-content: center;
margin: 10% auto;
}

#backBtn,
#nextBtn {
width: 50px;
cursor: pointer;
margin: 40px;
}

.gallery div img:hover {
filter: grayscale(0);
cursor: pointer;
transform: scale(1.1);
}