From 8442adfa07d9c1b1dfa7a1334bd82133781709f0 Mon Sep 17 00:00:00 2001 From: Neeraj Date: Sat, 27 Jan 2024 08:43:15 +0530 Subject: [PATCH] [ISSUE - 175] Add newsletter pop up box --- index.html | 38 +++++++++++++++++- index.js | 30 ++++++++++++++ styles.css | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 179 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 0cdb27bc..011c438e 100644 --- a/index.html +++ b/index.html @@ -20,7 +20,6 @@ href="img/A T logo with a white background and a square shape, connected to nature for a travel company.png" type="image/x-icon" /> - @@ -57,7 +56,7 @@ - + @@ -122,6 +121,40 @@

Find Your Perfect Getaway
Discover the World's Best + + + +
@@ -526,6 +559,7 @@

Reach Out To Us

}) + diff --git a/index.js b/index.js index ad7f115a..994cc83c 100644 --- a/index.js +++ b/index.js @@ -20,3 +20,33 @@ function sendMail() { .catch(err=>console.log(err)); } + +// Modal JS + +const modalContainer = document.querySelector(".modal-container"); +const closeBtn = document.querySelector("#close-btn"); +const subscribeBtn = document.querySelector("#news-subscribe"); +const form = document.querySelector("#modal-form"); + +function openModal() { + modalContainer.style.display = "flex"; +} + +function closeModal() { + modalContainer.style.display = "none"; +} + +// Function to handle form submission (you can customize this) +function subscribe(e) { + e.preventDefault(); + const emailInput = document.querySelector("#modal-email").value; + // You can add your logic to handle the form submission here + // alert("Email subscribed: "+emailInput); + closeModal(); +} + +form.addEventListener("submit", subscribe) +// closeBtn.addEventListener("click", closeModal); + +// Open the modal as soon as the page loads +window.onload = openModal(); \ No newline at end of file diff --git a/styles.css b/styles.css index e22cc01e..20b81cfa 100644 --- a/styles.css +++ b/styles.css @@ -238,6 +238,119 @@ header { margin-top: 1rem; } +/* Newsletter Modal */ + +.modal-container { + display: flex; + align-items: center; + justify-content: center; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.7); + backdrop-filter: blur(10px); + z-index: 2000000000; +} + +.modal-wrapper{ + position: relative; + max-width: 600px; + width: 100%; + display: flex; + background: #fff; + overflow: hidden; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + border-radius: 5px; +} + +.modal-image{ + height: 100%; + transform: scale(1.1); + object-position: center; + object-fit: cover; + max-width: inherit; +} + + +.modal-newsletter { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + padding: 40px; + border-radius: 5px; + max-width: 400px; + width: 100%; +} + +.modal-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 15px; +} + +.cross-container{ + position: absolute; + display: flex; + justify-content: flex-end; + width: 100%; + height: fit-content; + z-index: 1; + padding: 1rem; +} + +.close-btn{ + + font-size: 1.5rem; + color: #000; + cursor: pointer; + transition: color 0.3s ease-in-out; +} + +.close-btn:hover{ + color: #ff0000; +} + +.modal-content form { + display: flex; + flex-direction: column; + gap: 0.5rem; +} + +.modal-content input { + margin-bottom: 10px; + padding: 8px; + border-radius: 5px; + border: 2px solid #efefef; +} + +.modal-btn { + padding: 10px; + background-color: #091020; + border-radius: 5px; + color: #fff; + border: none; + outline: none; + cursor: pointer; + transition: scale 0.3s ease-in-out; +} + +.modal-btn:active { + scale: 0.95; +} + +.close-btn { + background: none; + border: none; + cursor: pointer; +} + + +/* Modal End */ + .story { display: flex; align-items: center;