167

Sliding Nav Highlight

Hovering menu items slides a pill highlight to that item

Layout & pageHover & clickUI interactionApp UICSSCSS + JS

Hannah's Motion Library
Web motion effects × AI prompts

AI prompt

A pill-shaped nav bar; when the mouse moves onto an item, a pill-shaped background slider glides over from its current position and resizes to fit that item, while the text switches to a color that contrasts with the slider; when the mouse leaves the whole menu, the slider returns to the current page's item. About 0.4 s with a tiny overshoot. (How: on pointerenter read the item's offsetLeft and offsetWidth and set the slider's translateX and width, transition cubic-bezier(.2,.9,.3,1.1))

When you copy it, a note to “match the site’s existing theme colors” is added automatically, so you don’t need to specify colors.

How to use it

  1. Tap “Copy AI prompt”.
  2. Paste it into an AI such as ChatGPT or Claude, and tell it which element on your site to apply it to (for example, the homepage headline or a buy button).
  3. The AI writes code that matches your site’s colors. Paste it into your project, then fine-tune the timing and distances.

More layout & page effects

346 more motion effectsText, buttons, cards, backgrounds, cursors… preview them all and copy AI prompts

Browse all effects →