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

Refactor multiple HTML and JavaScript files for improved functionality #1060

Closed
Closed
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
32 changes: 25 additions & 7 deletions Product-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,27 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Product Quick View</title>
<link rel="stylesheet" href="styles/view.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> <!-- Font Awesome -->
</head>
<body>
<!-- Eye Icon to Trigger Modal -->
<div class="product-container">
<img src="product-image.jpg" alt="Product" class="product-img">
<button class="quick-view-btn" onclick="openModal()">
<img src="product-image.jpg" alt="Papaya Pineapple Ice Cream" class="product-img">
<button class="quick-view-btn" onclick="openModal()" aria-label="Quick View">
<i class="fa fa-eye"></i> <!-- Eye icon for quick view -->
</button>
</div>

<!-- Quick View Modal -->
<div id="quickViewModal" class="modal">
<div id="quickViewModal" class="modal" role="dialog" aria-labelledby="modal-title" aria-modal="true" style="display: none;">
<div class="modal-content">
<span class="close" onclick="closeModal()">&times;</span>
<span class="close" onclick="closeModal()" aria-label="Close">&times;</span>
<div class="modal-left">
<img src="product-image.jpg" alt="Product" class="modal-product-img">
<img src="product-image.jpg" alt="Papaya Pineapple Ice Cream" class="modal-product-img">
</div>
<div class="modal-right">
<h2>Papaya Pineapple Ice Cream</h2>
<p>The delightful duo of papaya and pineapple makes this an irresistible flavour. Papaya is sourced from Solapur and Pineapple from Kerala. Just to give you a taste that’s truly memorable!</p>
<h2 id="modal-title">Papaya Pineapple Ice Cream</h2>
<p>The delightful duo of papaya and pineapple makes this an irresistible flavour. Papaya is sourced from Solapur and Pineapple from Kerala, giving you a taste that’s truly memorable!</p>
<h3>Ingredients</h3>
<p>Milk, Pineapple Pulp, Papaya Pulp, Sugar</p>
<h3>Available In</h3>
Expand All @@ -34,5 +35,22 @@ <h3>Available In</h3>
</div>

<script src="script/products.js"></script>
<script>
function openModal() {
document.getElementById("quickViewModal").style.display = "block";
}

function closeModal() {
document.getElementById("quickViewModal").style.display = "none";
}

// Close modal when clicking outside of the modal content
window.onclick = function(event) {
const modal = document.getElementById("quickViewModal");
if (event.target === modal) {
closeModal();
}
}
</script>
</body>
</html>
Loading