Back to Projects
Corporate Website

King Law Firm

A modern, high-performance corporate website for a law firm, featuring headless CMS integration, complex scroll-linked stacking animations, and an infinite logo marquee.

King Law Firm

Project Overview Overview

RoleFrontend Developer & UI Engineer
Timeline3 Weeks
TeamSolo Developer
PlatformResponsive Web

The King Law Firm website was constructed using a decoupled architecture, employing semantic HTML, custom CSS variables, and Vanilla JavaScript on the frontend, while utilizing Sanity CMS as a headless backend for content management.

Key technical implementations include a highly interactive scroll-linked stacking card animation for testimonials, an infinite-scrolling SVG logo marquee using CSS keyframes, and an Intersection Observer-based video autoplay system to ensure optimal performance. The site also features a dynamic, tabbed FAQ section and mobile navigation with background blur effects.

Tech Stack Stack

HTML5 CSS3 Vanilla JavaScript Sanity CMS GROQ

Sanity.io Sanity.io

Headless CMS

Vanilla JS Vanilla JS

Performance

Key Features Features

  • Sanity CMS Headless Integration
  • Scroll-Linked Stacking Card Animations
  • Infinite CSS Logo Marquee
  • Intersection Observer Video Autoplay
  • Category-Filtered Interactive FAQ

In Motion Motion

Responsive Design Devices

A seamless experience across desktop, tablet, and mobile devices.

Desktop View
Tablet View
Mobile View

Technical Challenges Core

The Problem

Creating a sticky, stacking card scroll effect for the testimonials section that works smoothly across different viewport heights without jank.

The Solution

Utilized a combination of CSS 'position: sticky' on the parent container and custom JavaScript math tracking 'window.scrollY' mapped against the container's boundaries to calculate precise translation and scaling values for each card dynamically.

The Problem

Loading dynamic content efficiently without a traditional build step or server-side rendering framework.

The Solution

Imported the '@sanity/client' directly via ESM modules ('https://esm.sh') in a script tag, executing GROQ queries in real-time to hydrate the DOM upon load.

Insights

Key Takeaways

  • Integrated Sanity CMS as a headless backend via ESM imports directly in the browser to fetch and render dynamic hero content using GROQ queries.
  • Engineered a complex scroll-linked animation system using Vanilla JavaScript to stack and unstack testimonial cards interactively based on scroll progress mapped against the container's bounding rectangle.
  • Implemented an infinite-scrolling logo marquee purely in CSS, optimizing performance and eliminating the need for heavy JavaScript slider libraries.
  • Utilized the Intersection Observer API for intelligent video autoplay/pause functionality, ensuring media only plays when visible to preserve client resources.

Project Outcomes Impact

  • Delivered a visually striking, highly interactive platform that establishes digital authority for the firm.
  • Empowered the client to manage critical site copy independently via the Sanity Studio dashboard without developer intervention.