Skip to content
animorio
IT
Back to the library

Find in page

Text, HoverGSAP, CSS onlyMediumCompressed weight: Demo 7.3 KBGSAP 28 KBFreeDownload the zip

Search inside a document in Draftly, a made-up writing app, in the clean style of today’s apps: Ctrl F drops the bar, a word is typed and every time it appears in the text it lights up one after another with a soft highlighter. The arrows jump from one to the next, the document scrolls there, the active word swells once and the counter rolls; on the right a thin rail marks where they all are.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Find in page" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>The find in page search with the words lighting up</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage" data-stage>
    <!-- a made-up docs app, Draftly: Ctrl F opens the find bar, a word is typed, every match lights up,
         the arrows jump from one to the next and the page scrolls to it -->
    <section class="doc" aria-label="Draftly document with find in page" data-card>
      <header class="doc__top">
        <span class="brand">
          <svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true"><path d="M5 3h7l3 3v11H5z"/><path d="M8 9h4M8 12h4M8 15h2"/></svg>
          <span class="brand__name">Draftly</span>
          <span class="brand__sep" aria-hidden="true">/</span>
          <span class="brand__doc">Brand voice guide</span>
        </span>
        <span class="keys" aria-hidden="true"><kbd data-key>Ctrl</kbd><kbd data-key>F</kbd></span>
      </header>

      <div class="doc__body">
        <div class="find-wrap" data-wrap>
          <div class="find" role="search" data-find>
            <svg class="find__icon" viewBox="0 0 20 20" aria-hidden="true"><circle cx="8.5" cy="8.5" r="5.5"/><path d="m13 13 4 4"/></svg>
            <input class="find__input" data-input type="text" placeholder="Find in document" aria-label="Find in document" spellcheck="false" autocomplete="off">
            <span class="find__count" aria-live="polite"><span class="roll"><span class="roll__col" data-roll></span></span><span class="find__of">of</span><span data-total>0</span></span>
            <span class="find__div" aria-hidden="true"></span>
            <button class="find__btn" type="button" aria-label="Previous match" data-prev><svg viewBox="0 0 20 20" aria-hidden="true"><path d="m5.5 12.5 4.5-4.5 4.5 4.5"/></svg></button>
            <button class="find__btn" type="button" aria-label="Next match" data-next><svg viewBox="0 0 20 20" aria-hidden="true"><path d="m5.5 7.5 4.5 4.5 4.5-4.5"/></svg></button>
            <button class="find__btn" type="button" aria-label="Close find" data-close><svg viewBox="0 0 20 20" aria-hidden="true"><path d="m6 6 8 8M14 6l-8 8"/></svg></button>
          </div>
        </div>

        <div class="doc__view" data-view>
          <article class="page" data-page></article>
          <div class="rail" aria-hidden="true" data-rail><span class="rail__thumb" data-thumb></span></div>
        </div>
      </div>
    </section>

    <svg class="cursor" data-cursor viewBox="0 0 24 24" aria-hidden="true"><path d="M5 2.8v16.4l4.2-4 2.8 6.2 2.9-1.3-2.8-6.1h5.9Z"/></svg>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

23 values to change

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Find in page” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a very light grey background there is a white document with round corners and a wide, soft shadow: at the top the Draftly mark, the name of the document, Brand voice guide, and on the right two keys, Ctrl and F. Below, the text: a heading and six short paragraphs about how a brand writes. The two keys press down one after the other and at the top right of the document the search bar drops in on a small spring, floating over the text, with the amber glow of an active field. The word brand types itself letter by letter, then every time it appears in the text it lights up one after another: a yellow wash grows from the left behind the word and settles back by a hair. On the thin rail on the right, marks appear where they are, and the counter says 1 of 7. The first turns amber, with a light ring, and swells once. A drawn pointer presses the down arrow: the next word becomes active, the document scrolls there on a soft curve, the digit of the counter rolls, the mark on the rail darkens, the rail handle moves down. Five jumps, then one back with the up arrow; then the cross: the words go out from the last to the first, the bar rises and disappears, the document goes back to the top. Everything works by hand too: click the document or press Ctrl F, type another word, Enter and Shift Enter, Esc.

How it works

The document as data

The text is a list of blocks, heading and paragraphs. On every search the script rebuilds them, splitting the text with a case-insensitive regular expression, and each match becomes a span with two children: the wash and the text.

The growing wash

The wash sits absolutely behind the word and grows with scaleX from the left, in a row with a stagger and a light back.out: the text is not inside the wash, so it never squashes.

The fake scroll

The page does not really scroll: it is moved up with a transform until the active word sits a little above the middle of the window, within the limits of the document. The rail handle follows the same number.

The rolling counter

The counter is a column of digits from zero to the total inside a window one line high: to go to match n the column moves up n lines with yPercent.

The rail of marks

For every match a thin dash on the rail on the right, at the same height in proportion to the document; the one for the active word is darker and thicker.

Values to change

NameFileDefaultWhat it changes
QUERYscript.jsbrandThe word the autopilot searches for in the document.
TYPEscript.js0.11The seconds between one letter and the next while the word is typed.
LIGHTscript.js0.07The seconds between one match and the next as they light up.
SCROLLscript.js0.65The seconds the document takes to scroll to the active word.
STEPscript.js0.95The seconds between one jump and the next with the autopilot.
PULSEscript.js1.1How much the active word swells when it is reached, once only.
HIT_COLORscript.js#fde68aThe colour of the matches.
ACTIVE_COLORscript.js#f59e0bThe colour of the active word and the marks on the rail.

Try them in the Playground

When to use it

For the landing page of a docs, notes or writing app, or an editor: it shows in a few seconds something everyone uses, searching for a word and jumping from one result to the next. Also as a real search inside a long page of text.

On phones

The same animation with adapted sizes: the document is also sized on the window height, the text shrinks with the short side, under 420 pixels the app name disappears and the bar gets narrower; the arrows and the cross are tapped with a finger.

With reduced motion

No dropping bar, growing wash, smooth scroll or swell: the bar is already open with the word typed, the matches are already lit and the third is active; the arrows change the active word and move the document without motion.

Pitfalls

  • The wash is a sibling of the text, not its parent: with scaleX on the parent the word would squash while the wash grows.
  • The position of each word is read from the difference between its rectangle and the page’s, which already includes the transform: so the jump is right even halfway through a scroll.
  • The active word pulses once only, with yoyo and repeat 1: a continuous pulse would be a glowing dot by another route.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 7.3 KB; the libraries: GSAP 28 KB.

Testing

Tested on 28 October 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All animations