Skip to content

Cards with a following halo in WordPress

A row of cards where the hovered card lights up with a halo that follows the mouse and brightens its edge closest to the pointer.

Here is an excerpt of this component's code in WordPress. The full code is free for members, ready to copy into your project.

This component also comes in

Open in a new tab

The code in WordPress

effet-cartes-survol-halo-suiveur.php
<?php
/**
 * Plugin Name: Forge, Cartes avec halo suiveur
 * Description: Une rangée de cartes dont la carte survolée s’éclaire d’un halo qui suit la souris et allume son liseré au plus près du pointeur. Ajoute la composition « Cartes avec halo suiveur » à l'éditeur de blocs.
 * Version: 1.0.0
 * Requires at least: 6.6
 * Requires PHP: 8.1
 * Author: Forge
 * License: GPL-2.0-or-later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: forge-effet-cartes-survol-halo-suiveur
 *
pattern.html
<!-- wp:html -->
<section class="ehs" aria-labelledby="ehs-titre" data-ehs data-ehs-style="doux">
        <div class="ehs__head">
          <p class="ehs__eyebrow">Domaine des Coteaux Rouges · Saumur</p>
          <h2 class="ehs__title" id="ehs-titre">Trois façons de découvrir le domaine</h2>
          <p class="ehs__intro">Caves creusées dans le tuffeau, chai familial et vignes en terrasses : choisissez votre visite, nous vous accueillons du mardi au samedi.</p>
        </div>
        <ul class="ehs__row" role="list" data-ehs-row>
          <li class="ehs__card" data-ehs-card>
            <span aria-hidden="true" data-ehs-fx>
              <span data-ehs-glow></span>
              <span data-ehs-ring><span data-ehs-spot></span></span>
script.js
(() => {
  if (!document.querySelector(".ehs")) return;
  document.querySelectorAll("[data-ehs-row]").forEach((row) => {
    const reduce = window.matchMedia("(prefers-reduced-motion: reduce)");
    let card = null;
    let point = { x: 0, y: 0 };
    let frame = 0;

    const paint = () => {
      frame = 0;
      if (!card) return;
      const box = card.getBoundingClientRect();
style.css
:root {
  --demo-effet-cartes-survol-halo-suiveur-bg: #f3ece8;
  --demo-effet-cartes-survol-halo-suiveur-text: #1c1917;
}

@media (prefers-color-scheme: dark) {
  :root.forge-follows-system:not([data-theme="light"]) {
    --demo-effet-cartes-survol-halo-suiveur-bg: #0a0608;
    --demo-effet-cartes-survol-halo-suiveur-text: #fdf2f4;
  }
}

Free component: copy it freely, including for commercial projects.

Visual effects components in WordPress
  • Cards that fade in as they enter the screen, one after another in each row, without a line of JavaScript and with a static fallback.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A translucent card with a saturated blur whose sharper edge refracts the colourful shapes drifting behind it, with an opaque fallback when transparency is reduced.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A help block shaped like a conversation: bubbles, three animated typing dots and clickable quick replies that show your answers to frequent questions, frozen under prefers-reduced-motion.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A paragraph whose words turn from grey to full ink, one by one, as the page scrolls, in pure CSS with a plain-text fallback.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Four offset, translucent sine waves gently roll along the bottom of a section, each at its own pace.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component