Skip to content

Commit

Permalink
pop up added
Browse files Browse the repository at this point in the history
  • Loading branch information
tester committed Oct 31, 2024
1 parent 21f94b3 commit d34d9c7
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
25 changes: 25 additions & 0 deletions css/popup.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.popup {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
justify-content: center;
align-items: center;
}

.popup-image {
max-width: 90%;
max-height: 90%;
}

.close {
position: absolute;
top: 20px;
right: 30px;
color: white;
font-size: 40px;
cursor: pointer;
}
25 changes: 22 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/>
<link rel="stylesheet" href="css/output.css" />
<link rel="stylesheet" href="css/messages.css">
<link rel="stylesheet" href="css/popup.css">

<style>
/* Add styles for the hamburger menu and responsive design */
Expand Down Expand Up @@ -365,6 +366,7 @@
class="w-[96%] rounded-xl my-2"
src="public/sample.jpeg"
alt="..."
onclick="openPopup('public/sample.jpeg')"
/>
</div>
<div class="icons flex mx-2 justify-around text-gray-600">
Expand Down Expand Up @@ -453,6 +455,7 @@
class="w-[96%] rounded-xl my-2"
src="public/sample2.jpeg"
alt="..."
onclick="openPopup('public/sample2.jpeg')"
/>
</div>
<div class="icons flex mx-2 justify-around text-gray-600">
Expand Down Expand Up @@ -592,9 +595,13 @@ <h1 class="text-xl font-bold p-3">Who to follow</h1>
>
<div class="text-blue-400 hover:underline">Show more</div>
</div>
</div>
</div>
</div>
</div>
<div class="popup" id="popup">
<span class="close" onclick="closePopup()">&times;</span>
<img class="popup-image" id="popup-image" src="" alt="Enlarged Image">
</div>
</div>
</div>


<script>
Expand Down Expand Up @@ -628,6 +635,18 @@ <h1 class="text-xl font-bold p-3">Who to follow</h1>
hamburgerMenu.classList.toggle("show"); // Toggle visibility of the hamburger menu
});

function openPopup(imageUrl) {
const popup = document.getElementById('popup');
const popupImage = document.getElementById('popup-image');

popupImage.src = imageUrl; // Set the image URL
popup.style.display = 'flex'; // Show the pop-up
}

function closePopup() {
const popup = document.getElementById('popup');
popup.style.display = 'none'; // Hide the pop-up
}
</script>


Expand Down

0 comments on commit d34d9c7

Please sign in to comment.