Water Park and Resort Website Template in HTML, Tailwind CSS, and JavaScript

Faraz

By Faraz -

Create a water park and resort website template using HTML, Tailwind CSS, and JavaScript. Simple steps to build fast, responsive, and modern templates.


water-park-and-resort-website-template-using-html-tailwind-css-and-javascript.webp

Table of Contents

  1. Project Introduction
  2. HTML Code
  3. CSS Code
  4. JavaScript Code
  5. Conclusion
  6. Preview

Looking to create a beautiful Water Park and Resort website? Whether you're a beginner or a web designer, using HTML, Tailwind CSS, and JavaScript can help you build a fast, clean, and modern website. In this guide, we’ll walk you through each step to build your own template from scratch.

Prerequisites:

Before you start, make sure you have:

  • Basic knowledge of HTML, CSS, and JavaScript
  • A code editor like VS Code
  • Tailwind CSS CDN or installed locally
  • A browser to test the design

Let’s dive into creating a fun and vibrant website for your water park or resort!

Source Code

Step 1 (HTML Code):

First, we will begin with the HTML structure of the website. This will be the base layout of your site. We'll use Tailwind CSS to handle the design and style, and for the image slider or carousel, we'll use a plugin called Splide.js.

Paste the HTML code given below into your index.html file

Step 2 (CSS Code):

Now that we have the layout, we’ll move to CSS styling. Even though we are using Tailwind CSS for most of the design, we still need some custom CSS. This is mainly for:

  • Splide Carousel styling
  • Custom scrollbars
  • FAQ section styling

Copy the CSS code below and paste it into your styles.css file:

body {
    font-family: 'Inter', sans-serif;
    color: #374151;
    overflow-x: hidden;
}

.font-display {
    font-family: 'Playfair Display', serif;
}

.hero-overlay-text {
    animation: fadeInText 2s ease-out forwards;
}

@keyframes fadeInText {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Splide Customizations (Optional - Splide has its own themes) */
.splide__arrow {
    background: rgba(249, 115, 22, 0.8);
    opacity: 0.7;
    transition: opacity 0.3s;
}

.splide__arrow:hover {
    opacity: 1;
}

.splide__arrow svg {
    fill: white;
}

.splide__pagination__page {
    background: #9CA3AF;
    opacity: 0.8;
    transition: background 0.3s, opacity 0.3s;
    width: 10px;
    height: 10px;
}

.splide__pagination__page.is-active {
    background: #F97316;
    transform: scale(1.2);
    opacity: 1;
}

.splide__pagination {
    bottom: auto !important;
}

.modal {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-content {
    transition: transform 0.3s ease;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    float: right;
    font-size: 1.5em;
    line-height: 1;
    transition: transform 0.3s ease;
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.pricing-toggle-bg {
    background-color: #3B82F6;
}

.pricing-toggle-dot {
    transform: translateX(0%);
    transition: transform 0.2s ease-in-out;
}

input:checked~.pricing-toggle-dot {
    transform: translateX(100%);
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #3B82F6;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2563EB;
} 

Step 3 (JavaScript Code):

This is our final step. Now, we will use JavaScript to add smart features to the website like:

  • Working carousel
  • Room modal popup
  • Newsletter form validation and submission
  • Scroll-to-top button
  • Dynamic pricing toggle
  • Interactive map popup

Copy the JavaScript code below and paste it into your script.js file:

document.addEventListener('DOMContentLoaded', function () {
    // --- Initialize Splide Sliders ---

    // Highlights Slider
    var highlightsSlider = document.getElementById('highlights-slider');
    if (highlightsSlider) {
        new Splide(highlightsSlider, {
            type: 'loop', // 'loop' or 'slide' or 'fade'
            perPage: 3, // Number of slides to show
            perMove: 1, // Number of slides to move on arrow click
            gap: '1.5rem', // Space between slides (Tailwind: space-x-6 is 1.5rem)
            autoplay: true,
            interval: 3000,
            pauseOnHover: true,
            pagination: true, // Show pagination dots
            arrows: false, // Hide arrows for this one, rely on autoplay and pagination
            breakpoints: {
                1023: { // lg and down
                    perPage: 2,
                    gap: '1rem',
                },
                639: { // sm and down
                    perPage: 1,
                    gap: '0.5rem',
                }
            }
        }).mount();
    }

    // Photo Gallery Carousel
    var gallerySlider = document.getElementById('gallery-slider');
    if (gallerySlider) {
        new Splide(gallerySlider, {
            type: 'fade', // Using fade effect for full-width gallery
            rewind: true, // Go back to the first slide after the last
            perPage: 1,
            autoplay: true,
            interval: 4000,
            pagination: true, // Show pagination
            arrows: true, // Show navigation arrows
            heightRatio: 0.5625, // For 16:9 aspect ratio (9/16), adjust as needed
            // Or set fixed height: height: '40rem',
        }).mount();
    }

    // Testimonials Slider
    var testimonialsSlider = document.getElementById('testimonials-slider');
    if (testimonialsSlider) {
        new Splide(testimonialsSlider, {
            type: 'loop',
            perPage: 1,
            autoplay: true,
            interval: 5000,
            pagination: true,
            arrows: false, // Typically testimonials don't need arrows if pagination is clear
        }).mount();
    }

    // Food Carousel (Optional)
    var foodCarousel = document.getElementById('food-carousel');
    if (foodCarousel) {
        new Splide(foodCarousel, {
            type: 'loop',
            perPage: 4,
            perMove: 1,
            gap: '1rem',
            autoplay: true,
            interval: 2500,
            pagination: true,
            arrows: false,
            breakpoints: {
                1023: { perPage: 3 },
                767: { perPage: 2 },
                639: { perPage: 1.5, gap: '0.5rem', focus: 'center' } // Show partial next slide on mobile
            }
        }).mount();
    }

    // --- Room Modal Functionality ---
    const roomCards = document.querySelectorAll('.room-card');
    const modal = document.getElementById('roomModal');
    const closeModalBtn = document.getElementById('closeModal');
    const modalRoomImage = document.getElementById('modalRoomImage');
    const modalRoomTitle = document.getElementById('modalRoomTitle');
    const modalRoomDetails = document.getElementById('modalRoomDetails');

    roomCards.forEach(card => {
        card.addEventListener('click', () => {
            modalRoomImage.src = card.dataset.roomImage;
            modalRoomImage.alt = card.dataset.roomTitle;
            modalRoomTitle.textContent = card.dataset.roomTitle;
            modalRoomDetails.textContent = card.dataset.roomDetails;
            modal.classList.remove('opacity-0', 'invisible');
            modal.classList.add('opacity-100', 'visible');
            document.body.style.overflow = 'hidden';
        });
    });

    if (closeModalBtn) {
        closeModalBtn.addEventListener('click', () => {
            modal.classList.add('opacity-0', 'invisible');
            modal.classList.remove('opacity-100', 'visible');
            document.body.style.overflow = 'auto';
        });
    }
    if (modal) {
        modal.addEventListener('click', (e) => {
            if (e.target === modal) {
                modal.classList.add('opacity-0', 'invisible');
                modal.classList.remove('opacity-100', 'visible');
                document.body.style.overflow = 'auto';
            }
        });
    }

    // --- Newsletter Form Validation & Submission ---
    const newsletterForm = document.getElementById('newsletterForm');
    const newsletterEmailInput = document.getElementById('newsletterEmail');
    const newsletterMessage = document.getElementById('newsletterMessage');

    if (newsletterForm) {
        newsletterForm.addEventListener('submit', function (e) {
            e.preventDefault();
            const email = newsletterEmailInput.value;
            newsletterMessage.textContent = '';

            if (!validateEmail(email)) {
                newsletterMessage.textContent = 'Please enter a valid email address.';
                newsletterMessage.classList.remove('text-green-300');
                newsletterMessage.classList.add('text-orange-300');
                newsletterEmailInput.focus();
                return;
            }

            newsletterMessage.textContent = 'Thank you for subscribing!';
            newsletterMessage.classList.remove('text-orange-300');
            newsletterMessage.classList.add('text-green-300');
            newsletterEmailInput.value = '';

            setTimeout(() => {
                newsletterMessage.textContent = '';
            }, 3000);
        });
    }

    function validateEmail(email) {
        const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
        return re.test(String(email).toLowerCase());
    }

    // --- Scroll-to-Top Button ---
    const scrollToTopBtn = document.getElementById('scrollToTopBtn');
    if (scrollToTopBtn) {
        window.addEventListener('scroll', () => {
            if (window.pageYOffset > 300) {
                scrollToTopBtn.classList.remove('opacity-0', 'invisible');
                scrollToTopBtn.classList.add('opacity-100', 'visible');
            } else {
                scrollToTopBtn.classList.add('opacity-0', 'invisible');
                scrollToTopBtn.classList.remove('opacity-100', 'visible');
            }
        });

        scrollToTopBtn.addEventListener('click', () => {
            window.scrollTo({ top: 0, behavior: 'smooth' });
        });
    }

    // --- Dynamic Pricing Toggler ---
    const pricingToggle = document.getElementById('pricingToggle');
    const prices = document.querySelectorAll('.price');
    const pricePeriods = document.querySelectorAll('.price-period');

    if (pricingToggle) {
        pricingToggle.addEventListener('change', function () {
            const isWeekly = this.checked;
            prices.forEach(priceEl => {
                priceEl.textContent = isWeekly ? priceEl.dataset.weekly : priceEl.dataset.daily;
            });
            pricePeriods.forEach(periodEl => {
                periodEl.textContent = isWeekly ? '/week' : '/night';
            });
        });
    }

    // --- Video Section Interactivity ---
    const playVideoButton = document.getElementById('playVideoButton');
    const videoThumbnail = document.getElementById('videoThumbnail');
    const videoPlayerContainer = document.getElementById('videoPlayerContainer');
    const YOUTUBE_VIDEO_ID = 'dQw4w9WgXcQ'; // Replace with your YouTube Video ID

    if (playVideoButton && videoThumbnail && videoPlayerContainer) {
        playVideoButton.addEventListener('click', () => {
            videoThumbnail.style.display = 'none';
            playVideoButton.style.display = 'none';
            videoPlayerContainer.innerHTML = ``;
            videoPlayerContainer.classList.remove('hidden');
        });
    }

    // --- Interactive Map Pop-up ---
    const mapHighlightBtn = document.getElementById('mapHighlightBtn');
    const mapHighlightPopup = document.getElementById('mapHighlightPopup');
    if (mapHighlightBtn && mapHighlightPopup) {
        mapHighlightBtn.addEventListener('mouseenter', () => {
            mapHighlightPopup.classList.remove('hidden');
        });
        mapHighlightBtn.addEventListener('mouseleave', () => {
            setTimeout(() => {
                if (!mapHighlightPopup.matches(':hover')) {
                    mapHighlightPopup.classList.add('hidden');
                }
            }, 200);
        });
        mapHighlightPopup.addEventListener('mouseleave', () => {
            mapHighlightPopup.classList.add('hidden');
        });
    }

    // --- Set Current Year in Footer ---
    const currentYearSpan = document.getElementById('currentYear');
    if (currentYearSpan) {
        currentYearSpan.textContent = new Date().getFullYear();
    }

    // --- Simple Animation on Scroll ---
    const animatedElements = document.querySelectorAll('[data-aos]');
    const observer = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.classList.add('aos-animate');
                entry.target.style.opacity = 1;
                if (entry.target.dataset.aos === 'fade-up') entry.target.style.transform = 'translateY(0)';
                else if (entry.target.dataset.aos === 'fade-right') entry.target.style.transform = 'translateX(0)';
                else if (entry.target.dataset.aos === 'fade-left') entry.target.style.transform = 'translateX(0)';
                else entry.target.style.transform = 'none';

                observer.unobserve(entry.target);
            }
        });
    }, { threshold: 0.1 });

    animatedElements.forEach(el => {
        el.style.opacity = 0;
        if (el.dataset.aos === 'fade-up') el.style.transform = 'translateY(20px)';
        else if (el.dataset.aos === 'fade-right') el.style.transform = 'translateX(-20px)';
        else if (el.dataset.aos === 'fade-left') el.style.transform = 'translateX(20px)';
        el.style.transition = 'opacity 0.6s ease-out, transform 0.6s ease-out';
        observer.observe(el);
    });

});

Final Output:

water-park-and-resort-website-template-using-html-tailwind-css-and-javascript.gif

Conclusion:

Building a Water Park and Resort Website using HTML, Tailwind CSS, and JavaScript is an effective way to create a professional and modern online presence. With essential sections like responsive navigation, eye-catching hero banners, feature highlights, interactive contact forms, and a clean footer, your website can deliver a smooth and engaging user experience.

Tailwind CSS allows for fast development with its powerful utility classes, while JavaScript adds advanced functionality such as image sliders, modal popups, form validation, and scroll effects. This makes your website not only attractive but also highly interactive.

This fully responsive layout is ideal for any water-themed business, including water parks, beach resorts, swimming pool websites, vacation destinations, or adventure parks. You can easily customize the design and features to match your brand and attract more visitors online.

Want the complete source code or a ready-to-use website template? Click the download button below to get started.

That’s a wrap!

I hope you enjoyed this post. Now, with these examples, you can create your own amazing page.

Did you like it? Let me know in the comments below 🔥 and you can support me by buying me a coffee

And don’t forget to sign up to our email newsletter so you can get useful content like this sent right to your inbox!

Thanks!
Faraz 😊

End of the article

Subscribe to my Newsletter

Get the latest posts delivered right to your inbox


Latest Components

Please allow ads on our site🥺