$1+
Add to cart

Magnetic Button Effect (JS + CSS) 🧲

$1+

Make your buttons come alive with this interactive cursor-follow effect!
This minimal JavaScript + CSS snippet makes a button subtly move toward your mouse (or finger on touch devices) when you hover near it.
Perfect for:

  • Call-to-action buttons
  • Portfolio websites
  • UI micro-interactions

Includes:

  • index.html (demo)
  • style.css (customizable styles)
  • script.js (logic for magnetic effect)
  • README.md (setup & customization guide)

Customizable variables:

  • --strength → How strongly it follows
  • --max-pull → Maximum movement in px
  • --activation → Hover activation radius in px

💻 Works in all modern browsers
📱 Touch-friendly
🎯 Reduced motion support

$
Add to cart

An interactive magnetic button effect using pure JS + CSS, where the button smoothly follows your cursor or touch. Lightweight, responsive, and easy to integrate into any website.

Size
4.61 KB
Powered by