UNPKG

@webpg/scroll-spy

Version:

Hi guys, welcome to this repository. I created a light-weight Scroll Spy library that you could fully customize with CSS. It's usage is really easy.

45 lines (42 loc) 1.89 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet" /> <link rel="stylesheet" href="./style.css" /> <title>Demo</title> </head> <body> <div class="links-wrap"> <span data-wg-link="#section-one">section one</span> | <span data-wg-link="#section-two">section two</span> | <span data-wg-link="#section-three">section three</span> | <span data-wg-link="#section-four">section-four</span> | <span data-wg-link="#section-five">section-five</span> </div> <div class="container"> <section data-wg-section="section-one" style="background-color: #2a9d8f"></section> <section data-wg-section="section-two" style="background-color: #e9c46a"></section> <section data-wg-section="section-three" style="background-color: #e76f51"></section> <section data-wg-section="section-four" style="background-color: #264653"></section> <section data-wg-section="section-five" style="background-color: #f4a261"></section> </div> <script type="module" src="/src/main.ts"></script> </body> </html>