Skip to content

Image Reveal Cursor on Hover

Tailwind CSS project list where hovering a row reveals a photo that follows the cursor with smooth easing and tilt, plus keyboard and touch fallbacks.

Also known as: image hover effect, hover image reveal, project list hover, follow cursor image

Image Reveal Cursor on Hover live demo

Open in new tab

Tailwind CSS code (HTML, CSS, JS)

An editorial project list built with Tailwind CSS where hovering a row reveals a photo that follows the mouse cursor. The preview glides behind the pointer with smooth easing, tilts with the movement and cross-fades between projects. It fits portfolio sites, design studios and agency case-study indexes.

How it works

The root is section.irc-reveal. The list (ul.irc-list) contains one link per project: a.irc-item with a data-irc-index, the large .irc-name title, a type column and an arrow. A single floating preview, div.irc-preview with data-irc-preview, sits at the end of the section. Its .irc-frame holds one img.irc-img per project, linked by data-irc-img.

The script listens to pointermove on the root and converts the cursor position into coordinates relative to the section. A requestAnimationFrame loop moves the preview a fraction of the remaining distance each frame (linear interpolation), sets translate3d() and a rotation based on the horizontal speed, and stops as soon as the preview settles. pointerenter on a row adds .is-current to that row and its photo and .is-active to the root; pointerleave on the list hides the frame again. In style.css, .is-active scales and fades in .irc-frame, .irc-img.is-current cross-fades the photo with a slight zoom-out, and the other rows dim to --irc-dim.

On first load (pointer devices only) the row whose index matches data-irc-default is already previewed beside its title, so the photo is visible before any interaction. When the pointer enters another row, the preview glides from that spot to the cursor and normal following takes over.

On devices without hover (@media (hover: none)) the floating preview is hidden and a small inline .irc-thumb image appears in every row instead, so touch users still see each project.

Customization

  • data-irc-ease on .irc-reveal: add a value between 0.05 (lazy, floaty) and 1 (sticks to the cursor); the default is 0.16.
  • data-irc-tilt on .irc-reveal: maximum rotation in degrees while moving; the default is 10.
  • h-[375px] w-[300px] on .irc-preview: change the preview size or ratio, e.g. h-[240px] w-[360px] for landscape photos.
  • --irc-dim in style.css: opacity of the rows that are not previewed; use 1 to disable dimming.
  • data-irc-default on .irc-reveal: index of the project shown on load; remove the attribute to start with the preview hidden.
  • Add a row by copying an li and adding a matching img.irc-img; keep data-irc-index and data-irc-img in sync.

Use cases

  • Portfolios and design studios: a project index that previews each project on hover
  • Agency case-study pages: an editorial list where the photo follows the pointer
  • Blogs and magazines: preview article images in a text-only list

Accessibility

Each project is a real link with a visible name, so the list works with a keyboard and screen readers on its own. The floating preview is aria-hidden="true" and pointer-events-none, because it only repeats what the link says. When a row receives keyboard focus the preview appears next to it, and every link shows an orange focus-visible outline. Under prefers-reduced-motion: reduce the preview jumps straight to the cursor without easing, tilt or zoom.

Usage notes

The photos come from Unsplash; replace them with your own project images. The demo links use href="#", which the script ignores; point them to real pages.

Image Reveal Cursor on Hover at a glance

Framework
Tailwind CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Tailwind CSS
Layout
Responsive, works on mobile
Category
Cursor Effects
License
Free for personal and commercial use

Questions about this template

Can I use the Image Reveal Cursor on Hover code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Tailwind CSS from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

The Tailwind browser build is for prototyping. In production, compile Tailwind with its CLI or your bundler.

Image Reveal Cursor on Hover – Tailwind CSS cursor effects component screenshot
Image Reveal Cursor on Hover · Tailwind CSS Cursor Effects

More Cursor Effects

Custom Cursor Follower – Pure CSS cursor effects preview

Custom Cursor Follower

Smooth custom cursor with a dot and an eased ring that grows on links, shows a label over cards and inverts the headline, in CSS and vanilla JS.

Cursor Trail Effect – Pure CSS cursor effects preview

Cursor Trail Effect

A chain of glowing dots that follows the mouse or finger and fades out behind it, with glow, rainbow and ring styles and an idle animation.