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

adding a description in the rotating image gallery #35

Open
wants to merge 5 commits into
base: main
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
27 changes: 1 addition & 26 deletions projects/rotating-image-gallery/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,7 @@
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="image-container">
<span style="--i: 1">
<img src="https://picsum.photos/id/237/300/200" />
</span>
<span style="--i: 2">
<img src="https://picsum.photos/id/23/300/200" />
</span>
<span style="--i: 3">
<img src="https://picsum.photos/id/48/300/200" />
</span>
<span style="--i: 4">
<img src="https://picsum.photos/id/12/300/200" />
</span>
<span style="--i: 5">
<img src="https://picsum.photos/id/59/300/200" />
</span>
<span style="--i: 6">
<img src="https://picsum.photos/id/160/300/200" />
</span>
<span style="--i: 7">
<img src="https://picsum.photos/id/370/300/200" />
</span>
<span style="--i: 8">
<img src="https://picsum.photos/id/478/300/200" />
</span>
</div>
<div class="image-container"></div>
<div class="btn-container">
<button class="btn" id="prev">Prev</button>
<button class="btn" id="next">Next</button>
Expand Down
46 changes: 46 additions & 0 deletions projects/rotating-image-gallery/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
const imageDetails = [
{
url: "https://picsum.photos/id/91/367/267",
description: "Description 1"
},
{
url: "https://picsum.photos/id/96/367/267",
description: "Description 2"
},
{
url: "https://picsum.photos/id/88/367/267",
description: "Description 3"
},
{
url: "https://picsum.photos/id/90/367/267",
description: "Description 4"
},
{
url: "https://picsum.photos/id/88/367/267",
description: "Description 5"
},
{
url: "https://picsum.photos/id/58/367/267",
description: "Description 6"
},
{
url: "https://picsum.photos/id/55/367/267",
description: "Description 7"
},
{
url: "https://picsum.photos/id/48/367/267",
description: "Description 8"
}
];

const imageContainerEl = document.querySelector(".image-container");

const prevEl = document.getElementById("prev");
Expand All @@ -16,7 +51,18 @@ nextEl.addEventListener("click", () => {
});

function updateGallery() {
const imagesHTML = imageDetails.map((detail, index) => `
<span style="--i: ${index + 1}">
<div class="image-wrapper">
<img src="${detail.url}" />
<div class="description">${detail.description}</div>
</div>
</span>
`).join("");

imageContainerEl.innerHTML = imagesHTML;
imageContainerEl.style.transform = `perspective(1000px) rotateY(${x}deg)`;

timer = setTimeout(() => {
x = x - 45;
updateGallery();
Expand Down
16 changes: 16 additions & 0 deletions projects/rotating-image-gallery/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ body {
width: 100%;
}

.image-wrapper {
position: relative;
}

.description {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
background-color: rgba(0, 0, 0, 0.7);
color: white;
padding: 5px;
box-sizing: border-box;
text-align: center;
}

.btn-container {
position: relative;
width: 80%;
Expand Down
67 changes: 28 additions & 39 deletions projects/tabs/index.html
Original file line number Diff line number Diff line change
@@ -1,56 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tabs Project</title>

<!-- styles -->
<title>Modern Tabs Design</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div class="section-center">
<div class="image">
<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fwww.hdnicewallpapers.com%2FWalls%2FBig%2FNature%2520and%2520Landscape%2FBeautiful_Sunrising_Nature_Image.jpg&f=1&nofb=1" alt="" />
</div>
<div class="tabs">
<!-- btn container -->
<div class="btn-container">
</head>
<body>
<div class="section-center">
<div class="image">
<h2>How to cook Abobo?</h2>
<img src="https://images.aws.nestle.recipes/resized/38a93505b258e61852c5c821ba1f55a1_nks-b3-d02_159_944_531.jpg" alt="Adobo" />
</div>
<div class="tabs">

<div class="btn-container">
<button class="button live" data-id="step1">Step 1</button>
<button class="button" data-id="step2">Step 2</button>
<button class="button" data-id="step3">Step 3</button>
</div>
<div class="tabs-content">
<!-- single item -->
<button class="button" data-id="step4">Step 4</button>
</div>
<div class="tabs-content">
<div class="content live" id="step1">
<h3>Step 1</h3>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Illum sint cumque quasi, amet impedit tempore necessitatibus iste. Ratione possimus perspiciatis sapiente, ex alias, ipsam sint beatae vel repellat aperiam corrupti porro et molestiae nobis itaque recusandae vitae atque! Reiciendis voluptatum molestiae autem consectetur corporis libero itaque quo mollitia quod! Corrupti doloribus veniam iusto soluta laborum saepe debitis reiciendis atque nihil eaque ducimus quo ullam ipsum, laboriosam velit vitae sint, eius molestiae unde, tempora hic ipsam? Cupiditate, beatae. Nostrum eos, id velit nisi libero exercitationem, et fugiat assumenda mollitia debitis deleniti, illum iusto. Officiis, ratione ex? Magni, impedit vel. Quam, eaque.</p>
<h3>Step 1</h3>
<p>Lorem ipsum dolor sit amet...</p>
</div>
<!-- end of single item -->
<!-- single item -->
<div class="content" id="step2">
<h3>Step 2</h3>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci molestiae doloremque enim deleniti voluptatum necessitatibus, facilis et quas, quasi magni obcaecati iusto ipsam ipsum amet autem labore dignissimos accusantium dolorem perspiciatis non harum, alias vel a asperiores? Qui amet tempora mollitia quos, facilis debitis nemo praesentium, optio facere nostrum, eum totam magnam quasi laborum sint repellendus quibusdam vero? Ipsum explicabo officiis culpa delectus quasi cumque saepe voluptates accusantium voluptatem omnis iste, sequi beatae quae dolor vero nostrum at amet eum dolores ut. Autem velit eius, libero adipisci dolore harum accusantium ipsum, voluptate ad recusandae vitae blanditiis? Harum nihil molestiae cum!
</p>

<h3>Step 2</h3>
<p>Lorem ipsum dolor sit amet...</p>
</div>
<!-- end of single item -->
<!-- single item -->
<div class="content" id="step3">
<h3>Step 3</h3>
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quaerat, asperiores magnam? In expedita laudantium magnam ratione alias minus nemo incidunt, dignissimos architecto placeat corporis molestiae labore vitae ullam laborum ut culpa eaque officiis, blanditiis sunt fugit ex? Neque quod mollitia delectus ipsa? Dolore veritatis, tenetur laudantium possimus unde debitis enim est illum, ea distinctio quod itaque quaerat ex sint eum optio in saepe labore sunt odit? Dolore, iusto! Ducimus sint laudantium consectetur. Velit facere culpa excepturi ad, quae distinctio iure incidunt. Odio alias laboriosam unde quo repudiandae corporis laborum quaerat asperiores minima quis in nam maxime recusandae iure, provident a?
</p>
<h3>Step 3</h3>
<p>Lorem ipsum dolor sit amet...</p>
</div>
<!-- end of single item -->
<div class="content" id="step4">
<h3>Step 4</h3>
<p>Lorem ipsum dolor sit amet...</p>
</div>
</div>
</div>

<!-- javascript -->
<script src="app.js"></script>
</body>
</div>
</div>
<script src="app.js"></script>
</body>
</html>
101 changes: 56 additions & 45 deletions projects/tabs/styles.css
Original file line number Diff line number Diff line change
@@ -1,82 +1,93 @@
body {
margin: 0;
padding: 0;
font-family: sans-serif;
background: #f5abc9;
color: grey;
}

img {
display: block;
width: 100%;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: #f0f2f5;
color: #333;
}

.section-center {
width: 90vw;
margin: 0 auto;
width: 80vw;
margin: 2rem auto;
max-width: 1170px;
min-width: 340px;
padding: 5rem 0;
padding: 2rem;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
border-radius: 8px;
background: #fff;
}

.image {
margin-bottom: 2rem;
}
img {
border-radius: 0.5rem;
.image img {
width: 100%;
border-radius: 8px 8px 0 0;
object-fit: cover;
height: 30rem;
height: 200px;
}

.tabs {
background: #ffe5e2;
border-radius: 0.5rem;
grid-template-rows: auto 1fr;
background: #ffffff;
}

.btn-container {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}
.button:nth-child(1) {
border-top-left-radius: 0.5rem;
}
.button:nth-child(3) {
border-top-right-radius: 0.5rem;
display: flex;
justify-content: center;
padding: 1rem;
}

.button {
padding: 1rem 0;
padding: 0.75rem 1.5rem;
border: none;
font-size: 1rem;
background: #b6c9f0;
background: #e4e6eb;
color: #050505;
cursor: pointer;
transition: all 0.3s linear;
letter-spacing: 0.25rem;
transition: background-color 0.3s ease;
margin: 0 10px;
border-radius: 20px;
}

.button:hover:not(.live) {
background: #e93b81;
color: white;
background: #d1d8e0;
}

.tabs-content {
padding: 2rem 1.5rem;
padding: 1rem;
transition: all 0.5s ease-in-out;
}
/* hide content */

.content {
display: none;
animation: fadeIn 0.5s ease-in-out;
}
.button.live {
background: #ffe5e2;

@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

.button.live, .button.live:hover {
background: #007bff;
color: #ffffff;
}

.content.live {
display: block;
}

@media (min-width: 992px) {
.image {
margin-bottom: 0;
.section-center {
display: grid;
grid-template-columns: 1fr 2fr;
gap: 20px;
}

.section-center {
display: grid;
grid-template-columns: 1fr 1fr;
column-gap: 2rem;
.image img {
height: auto;
border-radius: 8px;
}
}
31 changes: 14 additions & 17 deletions projects/testimonial-slider/index.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
<!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" />
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Testimonial Slider</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="testimonial-container">
<img
src="https://images.unsplash.com/photo-1570295999919-56ceb5ecca61?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=880&q=80"
alt="user-image"
/>
<p class="text">
This is simply unbelievable! I would be lost without Apple. The very
best. Not able to tell you how happy I am with Apple.
</p>
<h4 class="username">Cherise G</h4>
<img />
<p class="text"></p>
<h4 class="username"></h4>

<button class="arrow prev" onclick="prevTestimonial()"> &#10094; </button>
<div class="rating"></div>
<button class="arrow next" onclick="nextTestimonial()"> &#10095; </button>
</div>
<script src="index.js"></script>
</body>
</body>
</html>
Loading