The content on this website, including videos and code examples, is for educational purposes only. All demonstrations and designs are fictional and created to illustrate coding techniques. Any resemblance to existing websites or brands is purely coincidental.
The creators and administrators of this website do not claim ownership or affiliation with any existing websites or companies. Users are encouraged to use the information responsibly for learning purposes. Liability for any misuse of the content provided is not accepted.
Below is the html code for this video.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Balkan Style Image Gallery</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Gallery</h1>
</header>
<div id="scrollMark"></div>
<div class="gallery">
<div class="container">
<ul>
<a href="#" class="close"></a>
<li>
<a href="#img01">
<img src="https://images.unsplash.com/photo-1564668836804-05a2de350bb6?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="Image 1">
</a>
</li>
<li>
<a href="#img02">
<img src="https://images.unsplash.com/photo-1494905998402-395d579af36f?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="Image 2">
</a>
</li>
<li>
<a href="#img03">
<img src="https://images.unsplash.com/photo-1532926169706-d20b3ab66ff1?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="Image 3">
</a>
</li>
<li>
<a href="#img04">
<img src="https://images.unsplash.com/photo-1679512598221-3454804a8bd1?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="Image 4">
</a>
</li>
<li>
<a href="#img01">
<img src="https://images.unsplash.com/photo-1564668836804-05a2de350bb6?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="Image 1">
</a>
</li>
<li>
<a href="#img02">
<img src="https://images.unsplash.com/photo-1494905998402-395d579af36f?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="Image 2">
</a>
</li>
<li>
<a href="#img03">
<img src="https://images.unsplash.com/photo-1532926169706-d20b3ab66ff1?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="Image 3">
</a>
</li>
<li>
<a href="#img04">
<img src="https://images.unsplash.com/photo-1679512598221-3454804a8bd1?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="Image 4">
</a>
</li>
</ul>
</div>
<div class="wrapper" id="img01">
<div class="container">
<img src="https://images.unsplash.com/photo-1564668836804-05a2de350bb6?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="Image 1">
<div class="description">
<h1>Image 1</h1>
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Odit, iure soluta. Unde maiores harum
nulla nostrum aliquam tempora quaerat, ad officiis cumque accusamus magni exercitationem quos
odio nesciunt modi in!</p>
</div>
</div>
</div>
<div class="wrapper" id="img02">
<div class="container">
<img src="https://images.unsplash.com/photo-1494905998402-395d579af36f?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="Image 2">
<div class="description">
<h1>Image 2</h1>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Neque, dolore? Fugit consequatur
tempore similique omnis quasi alias aspernatur harum, voluptatum labore recusandae, dicta aut!
Dolorem ducimus quasi numquam debitis reiciendis!</p>
</div>
</div>
</div>
<div class="wrapper" id="img03">
<div class="container">
<img src="https://images.unsplash.com/photo-1532926169706-d20b3ab66ff1?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="Image 3">
<div class="description">
<h1>Image 3</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorum magni itaque sed! Expedita qui
sequi illo praesentium dolores nam voluptatem eum autem. Consequuntur excepturi obcaecati,
eveniet animi ullam esse eligendi.</p>
</div>
</div>
</div>
<div class="wrapper" id="img04">
<div class="container">
<img src="https://images.unsplash.com/photo-1679512598221-3454804a8bd1?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="Image 4">
<div class="description">
<h1>Image 4</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quasi labore doloremque a officia ullam
velit aut dolorum obcaecati deserunt deleniti eaque, architecto maxime dignissimos. Minus odio
nostrum impedit quae tenetur?</p>
</div>
</div>
</div>
</div>
<script src="index.js"></script>
</body>
</html>
Below is the css code for this video.
style.css
*, *::after, *::before {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100vh;
width: 100%;
background: #f4f1ee;
color: #2b2e2b;
font-family: sans-serif;
}
header {
background-color: #8da0a8;
color: #f4f1ee;
text-align: center;
padding: 60px 0;
}
header h1 {
font-size: 72px;
font-weight: 400;
text-transform: uppercase;
letter-spacing: 4px;
}
.gallery {
position: relative;
background: #f4f1ee;
padding: 50px 0;
overflow: hidden;
}
.gallery ul {
position: relative;
}
.gallery ul li {
position: relative;
width: 23.25%;
float: left;
margin: 25px 0.75%;
overflow: hidden;
}
.gallery ul li a {
position: relative;
display: block;
height: 100%;
width: 100%;
line-height: 0;
}
.gallery ul li a::before {
content: "";
position: absolute;
top: 40%;
left: 50%;
height: 50px;
width: 50px;
background: url(data:image/svg+xml;utf8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3C%21--%20Generator%3A%20Adobe%20Illustrator%2017.1.0%2C%20SVG%20Export%20Plug-In%20.%20SVG%20Version%3A%206.00%20Build%200%29%20%20--%3E%0A%3C%21DOCTYPE%20svg%20PUBLIC%20%22-//W3C//DTD%20SVG%201.1//EN%22%20%22http%3A//www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd%22%3E%0A%3Csvg%20version%3D%221.1%22%0A%09%20id%3D%22svg2%22%20xmlns%3Adc%3D%22http%3A//purl.org/dc/elements/1.1/%22%20xmlns%3Acc%3D%22http%3A//creativecommons.org/ns%23%22%20xmlns%3Ardf%3D%22http%3A//www.w3.org/1999/02/22-rdf-syntax-ns%23%22%20xmlns%3Asvg%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Asodipodi%3D%22http%3A//sodipodi.sourceforge.net/DTD/sodipodi-0.dtd%22%20xmlns%3Ainkscape%3D%22http%3A//www.inkscape.org/namespaces/inkscape%22%20inkscape%3Aversion%3D%220.48.4%20r9939%22%20sodipodi%3Adocname%3D%22icon-fullscreen.svg%22%0A%09%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20960%20560%22%0A%09%20enable-background%3D%22new%200%200%20960%20560%22%20xml%3Aspace%3D%22preserve%22%3E%0A%3Csodipodi%3Anamedview%20%20borderopacity%3D%221%22%20pagecolor%3D%22%23ffffff%22%20bordercolor%3D%22%23666666%22%20objecttolerance%3D%2210%22%20gridtolerance%3D%2210%22%20guidetolerance%3D%2210%22%20showgrid%3D%22false%22%20fit-margin-top%3D%220%22%20fit-margin-left%3D%220%22%20inkscape%3Azoom%3D%227.375%22%20inkscape%3Acx%3D%22-5.1525424%22%20inkscape%3Acy%3D%2216%22%20id%3D%22namedview11%22%20inkscape%3Awindow-x%3D%22-8%22%20inkscape%3Awindow-y%3D%22-8%22%20fit-margin-right%3D%220%22%20inkscape%3Apageopacity%3D%220%22%20fit-margin-bottom%3D%220%22%20inkscape%3Awindow-width%3D%221366%22%20inkscape%3Awindow-height%3D%22706%22%20inkscape%3Awindow-maximized%3D%221%22%20inkscape%3Apageshadow%3D%222%22%20inkscape%3Acurrent-layer%3D%22svg2%22%3E%0A%09%3C/sodipodi%3Anamedview%3E%0A%3Cg%3E%0A%09%3Crect%20x%3D%22220%22%20y%3D%22260%22%20fill%3D%22%23FFFFFF%22%20width%3D%22536%22%20height%3D%2224%22/%3E%0A%3C/g%3E%0A%3Cg%3E%0A%09%3Crect%20x%3D%22476%22%20y%3D%224%22%20fill%3D%22%23FFFFFF%22%20width%3D%2224%22%20height%3D%22556%22/%3E%0A%3C/g%3E%0A%3C/svg%3E%0A) no-repeat;
margin: -20px 0 0 -25px;
opacity: 0;
z-index: 1;
transition: all 0.5s linear;
}
.gallery ul li a:hover::before {
top: 50%;
opacity: 1;
}
.gallery ul li a::after {
content: "";
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
height: 100%;
width: 100%;
background: #2b2e2be6;
opacity: 0;
transition: all 0.5s linear;
}
.gallery ul li a:hover::after {
opacity: 1;
}
.container {
display: flex;
width: 100%;
max-width: 1080px;
justify-content: center;
align-items: center;
margin: 0 auto;
clear: both;
}
.container img {
height: auto;
max-width: 100%;
box-shadow: #2b2e2b80 0 2px 4px, #2b2e2b60 0 6px 12px -4px, #2b2e2b40 0 -4px 0 inset;
}
a {
color: #f4f1ee;
}
.wrapper {
position: absolute;
top: 0;
left: 0;
transform: translateY(-100%);
height: 100%;
width: 100%;
background-color: #f4f1ee;
padding-top: 50px;
z-index: 5;
visibility: hidden;
transition: all 0.5s ease-in-out;
}
.wrapper>* {
opacity: 1;
transition: all 0.5s linear;
transition-delay: 0.375s;
}
.wrapper img {
width: 55%;
border-radius: 8px;
}
.wrapper .description {
max-height: 100%;
width: 45%;
text-align: justify;
padding: 20px;
overflow: auto;
}
.wrapper h1 {
font-size: 36px;
line-height: 2;
text-align: center;
}
.wrapper.img_open {
transform: translateY(0%);
visibility: visible;
transition: all 0.5s ease-in-out;
}
.close {
position: absolute;
right: 10px;
top: -121px;
height: 25px;
width: 25px;
background: url(data:image/svg+xml;utf8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3C%21--%20Generator%3A%20Adobe%20Illustrator%2017.1.0%2C%20SVG%20Export%20Plug-In%20.%20SVG%20Version%3A%206.00%20Build%200%29%20%20--%3E%0A%3C%21DOCTYPE%20svg%20PUBLIC%20%22-//W3C//DTD%20SVG%201.1//EN%22%20%22http%3A//www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd%22%3E%0A%3Csvg%20version%3D%221.1%22%0A%09%20id%3D%22svg2%22%20xmlns%3Adc%3D%22http%3A//purl.org/dc/elements/1.1/%22%20xmlns%3Acc%3D%22http%3A//creativecommons.org/ns%23%22%20xmlns%3Ardf%3D%22http%3A//www.w3.org/1999/02/22-rdf-syntax-ns%23%22%20xmlns%3Asvg%3D%22http%3A//www.w3.org/2000/svg%22%0A%09%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2021%2021%22%0A%09%20enable-background%3D%22new%200%200%2021%2021%22%20xml%3Aspace%3D%22preserve%22%3E%0A%3Cg%20id%3D%22layer1%22%20transform%3D%22translate%280%2C-1031.3622%29%22%3E%0A%09%3Cpath%20id%3D%22path2987%22%20fill%3D%22none%22%20stroke%3D%22%23000000%22%20d%3D%22M0%2C1031.4l21%2C21%22/%3E%0A%09%3Cpath%20id%3D%22path2989%22%20fill%3D%22none%22%20stroke%3D%22%23000000%22%20d%3D%22M21%2C1031.4l-21%2C21%22/%3E%0A%3C/g%3E%0A%3C/svg%3E%0A%0A) no-repeat;
opacity: 1;
z-index: 9;
transition: all 0.25s ease-in-out;
}
.img_open .close {
top: -25px;
opacity: 1;
transition: all 0.5s ease-in-out;
}
Below is the javascript code for this video.
index.js
var galleryImageLinks = document.querySelectorAll(".gallery ul li a");
var closeBtn = document.querySelector(".close");
for (let i = 0; i < galleryImageLinks.length; i++) {
galleryImageLinks[i].addEventListener("click", function (e) {
e.preventDefault();
var imgID = this.getAttribute("href");
document.querySelector(".gallery ul").classList.add("img_open");
document.querySelector(imgID).classList.add("img_open");
window.scrollTo({ top: document.querySelector("#scrollMark").offsetTop, behavior: "smooth" });
closeBtn.addEventListener("click", function (e) {
e.preventDefault();
document.querySelector(".wrapper").classList.remove("img_open");
document.querySelector(".gallery ul").classList.remove("img_open");
document.querySelector(imgID).classList.remove("img_open");
});
});
}
Thanks for visiting