Hello! In today’s lesson, we’ll look at how to implement a simple “scroll to top” button using HTML, jQuery, and CSS.
As always, we start with the HTML code. Today’s structure is very basic:
<div class="to-top" data-btn="toTop"> ➡ </div>
Where:
to-top — the class we’ll use to style the button
data-btn="toTop" — a data attribute we’ll use to track scroll and click events (yes, we could use the class instead, but in this case we’ll use the data attribute)




