https://github.com/shannonhochkins/jquery.scrollactive
This plugin will automate animation, activate sections in the menu & the content & correctly assign hashes to the browsers window.
https://github.com/shannonhochkins/jquery.scrollactive
Last synced: 2 months ago
JSON representation
This plugin will automate animation, activate sections in the menu & the content & correctly assign hashes to the browsers window.
- Host: GitHub
- URL: https://github.com/shannonhochkins/jquery.scrollactive
- Owner: shannonhochkins
- Created: 2014-09-04T02:46:57.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-09-07T22:40:39.000Z (over 10 years ago)
- Last Synced: 2025-01-04T06:25:55.271Z (4 months ago)
- Language: CSS
- Size: 535 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.html
Awesome Lists containing this project
README
Scroll Active
This plugin will automate animation, activate sections in the menu & the content & correctly assign hashes to the browsers window. created by shannon hochkins.
Usage & Options
$('.element').scrollActive({
scanItems: '.post',
scanLimit: 200,
startScanningAfter: 50,
itemTopOffset: 0,
activeClass: 'active',
pageAnimationSpeed: 300,
updateHash: true,
hashPrefix: 'menu_',
debug: true,
onScroll: function(settings) {},
});Options
Options
Default
DescriptionscanItems
'.post'
CLASS of elements you want to scan to see if it's in the scan areascanLimit
200
The distance from the top that the plugin scans from, everything after this position from the top of the WINDOW not the document, will be activated.startScanningAfter
50
Disable the scanning until the user has scrolled a certain amount of pixels.itemTopOffset
0
You have an option to push the scan field down by an offset as well (positive or negative)activeClass
'active'
The class that will be appended to the menu items & the content on the pagepageAnimationSpeed
300
How fast the plugin will scroll to sections when clicked from the menuupdateHash
true
If the plugin should update the browsers hashhashPrefix
'menu_'
We prefix the hash, so that the browser doesn't automatically jump to a position on the pagedebug
false
will draw some helpful html on the page to indicate where the active sections will start being activatedonScroll
function() {settings}
Callback when the users has scrolled
Note: if you set the hashPrefix to an empty string you will see jumping if the animation speed is greater than 0.
Debug mode.
- The red section toward the top that is drawn indicates that any items who's top position falls inside the redZone, it's nolonger classed as active.
- The green section indicates that scan area, so the first item it finds who's top position is closest to the top of the green zone but NOT in the redZone, is classed as the active item.
- If the greenZone is PINK it means that the startScanningAfter variable is currently set to a larger pixel value than the user has scrolled, once the scroll count is larger than the startScanningAfter variable, it will start scanning.