Skip to content

Commit 85e1759

Browse files
committed
Add contact form section with WhatsApp integration
1 parent a7cbf45 commit 85e1759

File tree

3 files changed

+171
-1
lines changed

3 files changed

+171
-1
lines changed

css/style.css

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
*, *:before, *:after {
32
-webkit-box-sizing: border-box;
43
-moz-box-sizing: border-box;
@@ -2184,6 +2183,106 @@ blockquote {
21842183

21852184
}
21862185

2186+
/* --------- 6.6 Contact Form ---------- */
2187+
2188+
#contact {
2189+
clear: both;
2190+
overflow: hidden;
2191+
}
2192+
2193+
#contact .row {
2194+
max-width: 1245px;
2195+
margin: 0 auto;
2196+
padding: 75px 0;
2197+
position: relative;
2198+
}
2199+
2200+
.contact-form {
2201+
display: flex;
2202+
flex-wrap: wrap;
2203+
gap: 20px;
2204+
}
2205+
2206+
.contact-form .col-2 {
2207+
width: calc(50% - 10px);
2208+
padding: 0;
2209+
}
2210+
2211+
.contact-form .col-3 {
2212+
width: 100%;
2213+
padding: 0;
2214+
}
2215+
2216+
.contact-form label {
2217+
display: block;
2218+
margin-bottom: 8px;
2219+
font-weight: 600;
2220+
font-size: 14px;
2221+
}
2222+
2223+
.contact-form input,
2224+
.contact-form textarea,
2225+
.contact-form select {
2226+
width: 100%;
2227+
padding: 12px;
2228+
border: 1px solid #e1e1e1;
2229+
border-radius: 3px;
2230+
font-family: 'Open Sans', sans-serif;
2231+
font-size: 14px;
2232+
-webkit-transition: all 0.3s ease-out;
2233+
-moz-transition: all 0.3s ease-out;
2234+
transition: all 0.3s ease-out;
2235+
}
2236+
2237+
.contact-form input:focus,
2238+
.contact-form textarea:focus,
2239+
.contact-form select:focus {
2240+
border-color: #333;
2241+
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
2242+
}
2243+
2244+
.contact-form textarea {
2245+
resize: vertical;
2246+
min-height: 120px;
2247+
}
2248+
2249+
.contact-form button {
2250+
margin-top: 15px;
2251+
width: auto;
2252+
}
2253+
2254+
/* Responsive Contact Form */
2255+
2256+
@media (max-width: 767px) {
2257+
.contact-form .col-2 {
2258+
width: 100%;
2259+
}
2260+
}
2261+
2262+
@media (max-width: 480px) {
2263+
#contact .row {
2264+
padding: 35px 0 !important;
2265+
}
2266+
2267+
.contact-form .col-2 {
2268+
width: 100%;
2269+
padding: 0;
2270+
}
2271+
2272+
.contact-form .col-3 {
2273+
width: 100%;
2274+
padding: 0;
2275+
}
2276+
2277+
.contact-form label {
2278+
font-size: 13px;
2279+
}
2280+
2281+
.contact-form button {
2282+
width: 100%;
2283+
}
2284+
}
2285+
21872286

21882287

21892288

index.html

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,50 @@ <h2 class="section-title">What our customers are saying</h2>
259259
</aside>
260260
</main>
261261

262+
<!-- Contact Form Section -->
263+
<section id="contact" class="scrollto clearfix">
264+
<div class="row clearfix">
265+
<div class="col-3">
266+
<div class="section-heading">
267+
<h3>Get in Touch</h3>
268+
<h2 class="section-title">Contact Us</h2>
269+
<p class="section-subtitle">Have questions or ready to book your next ink session? Send us a message and we'll get back to you via WhatsApp!</p>
270+
</div>
271+
</div>
272+
<div class="col-2-3">
273+
<form id="contact-form" class="contact-form">
274+
<div class="col-2">
275+
<label for="name">Name</label>
276+
<input type="text" id="name" name="name" placeholder="Your Full Name" required>
277+
</div>
278+
<div class="col-2">
279+
<label for="phone">Phone Number</label>
280+
<input type="tel" id="phone" name="phone" placeholder="Your Phone Number" required>
281+
</div>
282+
<div class="col-2">
283+
<label for="email">Email</label>
284+
<input type="email" id="email" name="email" placeholder="Your Email Address" required>
285+
</div>
286+
<div class="col-2">
287+
<label for="service">Service Type</label>
288+
<select id="service" name="service" required>
289+
<option value="">Select a service</option>
290+
<option value="Custom Tattoo">Custom Tattoo</option>
291+
<option value="Cover-up Tattoo">Cover-up Tattoo</option>
292+
<option value="Piercing">Piercing</option>
293+
<option value="General Inquiry">General Inquiry</option>
294+
</select>
295+
</div>
296+
<div class="col-3">
297+
<label for="message">Message</label>
298+
<textarea id="message" name="message" placeholder="Tell us about your tattoo idea or inquiry..." rows="5" required></textarea>
299+
</div>
300+
<button type="submit" class="button">Send via WhatsApp</button>
301+
</form>
302+
</div>
303+
</div>
304+
</section>
305+
262306
<footer id="landing-footer" class="clearfix">
263307
<div class="row clearfix">
264308
<p id="copyright" class="col-2">Copyright © 2024 XO Inks All Rights Reserved.</p>

js/site.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,33 @@ $(document).ready(function () {
4444

4545
});
4646

47+
// WhatsApp Form Submission
48+
document.getElementById('contact-form').addEventListener('submit', function(e) {
49+
e.preventDefault();
50+
51+
const name = document.getElementById('name').value;
52+
const phone = document.getElementById('phone').value;
53+
const email = document.getElementById('email').value;
54+
const service = document.getElementById('service').value;
55+
const message = document.getElementById('message').value;
56+
57+
const whatsappMessage = `Hello XO Inks! 👋\n\n` +
58+
`Name: ${name}\n` +
59+
`Phone: ${phone}\n` +
60+
`Email: ${email}\n` +
61+
`Service: ${service}\n` +
62+
`Message: ${message}\n\n` +
63+
`Looking forward to hearing from you!`;
64+
65+
const encodedMessage = encodeURIComponent(whatsappMessage);
66+
67+
const whatsappNumber = '27734322826';
68+
69+
window.open(`https://wa.me/${whatsappNumber}?text=${encodedMessage}`, '_blank');
70+
71+
this.reset();
72+
});
73+
4774

4875

4976
$(window).load(function () {

0 commit comments

Comments
 (0)