Building a Nature-Themed Website with Next.js and Parallax Effects

OdynDevOdynDev
4 min read

Today, I want to share an impressive Next.js project I came across - a beautiful nature-themed website called "Natura by OdynDev" that implements stunning parallax scrolling effects. This project showcases how to combine modern web development techniques with aesthetic design principles to create an immersive user experience.


Project Overview

The website features a minimalist black and white design centered around mountain imagery, with several sections including:

  • A hero section with parallax mountain background

  • About section with information on nature preservation

  • Services/Actions section showcasing environmental initiatives

  • Gallery with filtered mountain images

  • Contact form with parallax water background effect

What makes this site special is its thoughtful implementation of parallax scrolling, which creates depth and dimension as users navigate through the content.


Key Technical Features

1. Parallax Scrolling Implementation

The core of the parallax effect is implemented through React's useState and useEffect hooks:

const [scrollY, setScrollY] = useState(0);

useEffect(() => {
  const handleScroll = () => {
    setScrollY(window.scrollY);
  };

  window.addEventListener('scroll', handleScroll);
  return () => {
    window.removeEventListener('scroll', handleScroll);
  };
}, []);

This tracks the user's scroll position, which is then used to transform various elements at different rates:

<div className="parallax-bg mountain-bg" style={{ transform: `translateY(${scrollY * 0.3}px)` }}>
  <Image 
    src="/mountain.jpg" 
    alt="Majestic mountains" 
    fill 
    priority
    style={{ objectFit: 'cover' }}
  />
</div>

2. Fade-In Animation with Intersection Observer

Another impressive feature is the smooth fade-in animation for content as you scroll:

useEffect(() => {
  const observer = new IntersectionObserver(
    (entries) => {
      entries.forEach((entry) => {
        if (entry.isIntersecting) {
          entry.target.classList.add('visible');
        }
      });
    },
    { threshold: 0.1 }
  );

  const elements = document.querySelectorAll('.fade-in');
  elements.forEach((el) => observer.observe(el));

  return () => {
    elements.forEach((el) => observer.unobserve(el));
  };
}, []);

This intelligently reveals content as it enters the viewport, creating a smooth scrolling experience.


3. Responsive Navigation with Mobile Menu

The site includes a responsive hamburger menu for mobile devices:

<div className="hamburger" onClick={() => setMenuOpen(!menuOpen)}>
  <div className={`bar ${menuOpen ? 'animate' : ''}`}></div>
</div>

The CSS transforms the hamburger icon into an X when the menu is open:

.bar.animate {
  opacity: 0;
}

.bar.animate::before {
  transform: rotate(45deg);
}

.bar.animate::after {
  transform: rotate(-45deg);
}

4. SVG Mountain Silhouettes

The project uses inline SVG for mountain silhouettes:

.mountain-silhouette {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 1200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0,200 L0,120 C100,140 200,80 300,100 C400,120 500,60 600,80 C700,100 800,50 900,70 C1000,90 1100,30 1200,50 L1200,200 Z' fill='black' opacity='0.5'/%3E%3C/svg%3E");
}

This creates a subtle layering effect that enhances the depth perception.


5. Creative Image Filtering

In the gallery section, a single mountain image is reused with different CSS filters to create visual variety:

{ title: 'Mountain Peak', desc: 'A majestic view of the mountain landscape.', filter: 'grayscale(100%)' },
{ title: 'Mountain Mist', desc: 'Mysterious mist enveloping mountain peaks.', filter: 'grayscale(100%) brightness(1.1)' },
{ title: 'Sunset', desc: 'A spectacular sunset over the mountains.', filter: 'grayscale(90%) sepia(20%)' },

CSS Techniques Worth Noting

Atmospheric Effects

The CSS includes several layering techniques to create atmospheric effects:

.mountain-mist {
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.05) 40%,
    rgba(255,255,255,0.1) 60%,
    rgba(255,255,255,0.15) 100%
  );
}

.fog-layer {
  background: linear-gradient(to bottom, 
    rgba(255,255,255,0.3) 0%,
    rgba(255,255,255,0.2) 20%,
    rgba(255,255,255,0.1) 40%,
    rgba(255,255,255,0) 60%);
}

Glass Morphism

The services and contact sections use backdrop-filter for a modern glass morphism effect:

.service-card {
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border-radius: 8px;
}

Lessons for Your Projects

This project offers several valuable takeaways:

  1. Reuse images creatively - The site uses a single mountain image with different filters and positions to create variety while maintaining coherence and reducing load times.

  2. Layer elements for depth - The combination of foreground silhouettes, background parallax, and atmospheric gradients creates a rich visual experience.

  3. Use subtle animations - The fade-in effects and parallax scrolling enhance the experience without overwhelming the user.

  4. Next.js Image optimization - The project leverages Next.js Image component for optimized image loading and display.

  5. SVG for decorative elements - Using SVG for mountain silhouettes allows for lightweight, scalable graphics.


Potential Improvements

While this is already an impressive project, here are some potential enhancements:

  1. Add lazy loading for sections further down the page

  2. Implement actual form handling functionality

  3. Add more varied imagery (currently relies heavily on a single mountain image)

  4. Add actual content and real action items about nature preservation

  5. Consider accessibility improvements for users who prefer reduced motion


Conclusion

This Next.js nature-themed website demonstrates how modern web technologies can create beautiful, immersive experiences. The combination of parallax effects, fade-in animations, and thoughtful design creates a compelling presentation that would work well for environmental organizations, nature photographers, or eco-tourism businesses.

The code is well-structured and provides an excellent template for anyone looking to create a similar scrolling experience in their Next.js projects.


Thank you 🙏

Thank you for reading this post! If you’d like to see more of my work, feel free to visit my portfolio:
👉 Click

I’m constantly working on improving my skills, building better projects, and striving to become a better developer every day. 💻
You can also find more of my projects and posts right here on my Profile and Portfolio - feel free to explore!

1
Subscribe to my newsletter

Read articles from OdynDev directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

OdynDev
OdynDev

My name is Daniel. I code, design, and get things done. I'm not a fan of school, but I love learning - on my own terms. I build websites that make sense, look good, and never feel boring. If you're looking for someone who does things right, with clarity and a human touch - I’m your guy.