项目
在 GitHub 查看
cmpolis/scrollIt.js
关于
一个 jQuery 插件,让创建带分页功能且支持垂直滚动的页面变得简单。
开发工具实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Demo and more information
About
ScrollIt.js(scroll•it•dot•js) makes it easy to make long, vertically scrolling pages. This is why it rocks:
- Easy to implement: One JS call, just put data- attributes on the DOM
- Lightweight: ~1kb minified
- Active Class: Your navigation is updated automatically
- Configurable: Set the animation easing, duration, callbacks and more
- Keyboard Navigation: Press the up and down keys to move...
Usage
- Include jQuery and scrollIt.js
<script src="jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="scrollIt.js" type="text/javascript"></script>
- Put a data-scroll-index attribute on each section
<div data-scroll-index="0">..content..</div>
<div data-scroll-index="1">...</div>
<div data-scroll-index="2">...</div>
- Put corresponding data-scroll-nav attributes on each nav
<a data-scroll-nav="0">About</a>
<a data-scroll-nav="1">Usage</a>
<a data-scroll-nav="2">Options</a>
- For links to sections, put on a data-scroll-goto attribute
<a data-scroll-goto="0">Back to top</a>
- Call scrollIt()
$(function(){
$.scrollIt();
});
Options
To customize scrollIt.js, simply pass in an options object: (defaults shown)
$.scrollIt({
upKey: 38, // key code to navigate to the next section
downKey: 40, // key code to navigate to the previous section
easing: 'linear', // the easing function for animation
scrollTime: 600, // how long (in ms) the animation takes
activeClass: 'active', // class given to the active nav element
onPageChange: null, // function(pageIndex) that is called when page is changed
topOffset: 0 // offste (in px) for fixed top navigation
});
Credit
Created by @ChrisPolis, blog
Feel free to use, share and fork.
Enjoy!
探索相关项目
加载中…