8000 GitHub - entipe/scroll-spy: Scrollspy in plain vanilla Javascript for modern browsers.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

entipe/scroll-spy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

scroll-spy

Scroll spy is small plain unobtrusive javascript that spies on the scrolling of a document window.

If you want to set the active link in your web page based on position of a name anchor as the page scrolls, this is the script for it.

Setup

If you know what a scroll-spy is already, all you want must be a script that achieves it without getting in your way.

Download the scroll-spy.js script.

Import the script into your html file using the <script> tag;

<script src="scroll-spy.js"></script>

Add attribute, data-scroll-spy to every named anchor you need to spy on, and you are done.

Note: Put <script> tags after your footer.

If you are new to scroll-spy, follow the rest of these instructions;

Setup your navigation link tags to point to your named anchors;

Add 'data-scroll-spy' attribute to your named anchor elements;

....
...

Create a special style for .active class in your stylesheet;

a.active{ background-color:#ccc; color:#333; }

You're all done.

About

Scrollspy in plain vanilla Javascript for modern browsers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%
0