-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
let scrollContainer = document.querySelector(".gallery"); | ||
let backBtn = document.getElementById("backBtn"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
}); |
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); | ||
} |
There was a problem hiding this comment.
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).