# fscrollspy.js

> scroll plugin refer to bootstrap-scrollspy.js and extend from it

Latest version **1.0.2** (published 2015-06-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install fscrollspy.js
pnpm add fscrollspy.js
yarn add fscrollspy.js
bun add fscrollspy.js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2015-06-26 |
| First published | 2015-06-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Frend |
| Maintainers | frend |
| Keywords | scrollspy |

## Links

- npm: https://www.npmjs.com/package/fscrollspy.js
- Repository: https://github.com/FrendEr/fScrollspy.js
- Issues: https://github.com/FrendEr/fScrollspy.js/issues
- npm.io page: https://npm.io/package/fscrollspy.js

## Alternatives

- [pagerjs](https://npm.io/package/pagerjs.md) — 60 weekly downloads
- [whistle.savefor-mock](https://npm.io/package/whistle.savefor-mock.md) — 4 weekly downloads
- [astro-better-toc](https://npm.io/package/astro-better-toc.md) — 0 weekly downloads
- [@crvouga/mockingbird-service-fcm](https://npm.io/package/@crvouga/mockingbird-service-fcm.md) — 0 weekly downloads
- [jabber](https://npm.io/package/jabber.md) — 0 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2015-06-26
- 1.0.1 — 2015-06-26
- 1.0.0 — 2015-06-26

## README

# fScrollspy.js - 屏幕滚动插件
这个插件fork自bootstrap的[scrollspy.js](https://github.com/twbs/bootstrap/blob/master/js/scrollspy.js)，在使用上进行了定制和拓展。

## Initialize
```javascript
var scrollspy = new Scrollspy({
	scrollElement: window,
	offset: 45,
	
	selector: '.nav-list a',
	activeCls: 'on',
	reachSelector: function() {
		$('.nav-list').css({
			position: 'fixed',
			top: 0,
			left: 0,
			zIndex: 999
		});
	},
	leaveSelector: function() {
		$('.nav-list').css({
			position: 'static'
		});
	},
	
	reachTarget: function() {
		if (!$('.nav-list').is(':visible')) {
			$('.nav-list').show();
		}
	},
	leaveTarget: function() {
		if ($('.nav-list').is(':visible')) {
			$('.nav-list').hide();
		}
	},
	
	scrollDown: function() {
		$('#directionTips').text('scrolling down').fadeIn(400);
	},
	scrollUp: function() {
		$('#directionTips').text('scrolling up').fadeIn(400);
	}
});
```

## Example
demo：[http://frender.github.io/fScrollspy.js](http://frender.github.io/fScrollspy.js)

## Options

- **scrollElement**: 监听滚动的元素，默认为window
- **offset**: 偏移量，为到达监听对象前后设置一个过渡距离
- **selector**: 选择器，在这里为监听滚动事件的导航元素
- **activeCls**: 选中状态下的导航元素的class
- **reachSelector**: 【回调函数】监听选择器到达最顶部的监听对象的事件
- **leaveSelector**: 【回调函数】监听选择器离开最顶部的监听对象的事件
- **reachTarget**: 【回调函数】监听选择器进入监听对象区域的事件
- **leaveTarget**: 【回调函数】监听选择器离开监听对象区域的事件
- **scrollDown**: 【回调函数】监听屏幕向下滚动的事件
- **scrollUp**: 【回调函数】监听屏幕向上滚动的事件

## Installation
```javascript
bower install fScrollspy.js --save(-dev)
```
or
```javascript
npm install fscrollspy.js --save(-dev)
```

##Version
- **1.0.0**

---
_Source: https://npm.io/package/fscrollspy.js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
