Magnetic & Scroll to Top

Small but eye-catching interaction widgets - a button drawn toward the cursor, and a floating return to the top of the page.

Magnetic Buttons

The button "pulls toward" the mouse cursor when it comes near.

<!-- Just add the .btn-magnetic class -->
<button class="btn btn-primary btn-magnetic">
  Magnetic button
</button>

Scroll to Top

A floating button that appears after scrolling down the page.

By default the button appears in the bottom-right corner of the screen.

<!-- Button placed at the very end of body -->
<button class="scroll-to-top" aria-label="Back to top">
  <svg class="icon" aria-hidden="true"><use href="img/icons-sprite.svg#ph-arrow-up"></use></svg>
</button>