jquery-scrollspy

A JQuery Implementation of David Walsh's MooTools scrollspy

  • 所有者: sxalexander/jquery-scrollspy
  • 平台:
  • 许可证:
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

jquery-scrollspy

This library is no longer actively supported or maintained.

For similar functionality checkout these other libraries:

--

An adaptation of the Mootools Scrollspy ( http://davidwalsh.name/mootools-scrollspy ) plugin for jQuery

(c) 2011 Samuel Alexander (sxalexander@gmail.com)

Released under The MIT License.

Description:

scrollspy is a simple jQuery plugin for firing events based on where the user has scrolled to in a page.

Homepage:

http://github.com/sxalexander/jquery-scrollspy

Source:

Hosted at GitHub; browse at:

http://github.com/sxalexander/jquery-scrollspy/tree/master

Or clone from:

git://github.com/sxalexander/jquery-scrollspy.git

Usage:

  1. Insert the necessary elements in your document's <head> section, e.g.:

     <script type='text/javascript' src='/javascripts/jquery.scrollspy.js'></script>
    

Remember to include jquery.scrollspy.js after including the main jQuery library.

  1. Initialise scrollspy in your document.onload, e.g.:

     <script type='text/javascript'>
         $(document).ready(function() {
     			$('#sticky-navigation').scrollspy({
     				min: $('#nav').offset().top,
     				onEnter: function(element, position) {
     					$("#nav").addClass('fixed');
     				},
     				onLeave: function(element, position) {
     					$("#nav").removeClass('fixed');
     				}
     			});
     		});
     </script>
    

Check out the /examples for more info !

Documentation:

Options for ScrollSpy include:

min: (defaults to 0) The minimum value of the X or Y coordinate, depending on mode.
max: (defaults to 0) The maximum value of the X or Y coordinate, depending on mode.
mode: (defaults to 'vertical') Defines whether to listen to X or Y scrolling.
container: (defaults to window) The element whose scrolling to listen to.

Events for ScrollSpy include:

scrollTick: Fires on each scroll event within the min and max parameters. Receives as parameters:

    position: an object with the current X and Y position.
    inside: a Boolean value for whether or not the user is within the min and max parameters
    enters: the number of times the min / max has been entered.
    leaves: the number of times the min / max has been left.

scrollEnter: Fires every time the user enters the min / max zone.
        position: an object with the current X and Y position.
        enters: the number of times the min / max has been entered.

scrollLeave: Fires every time the user leaves the min / max zone.
        position: an object with the current X and Y position.
        leaves: the number of times the min / max has been left.

A note on forking:

By forking this project you hereby grant permission for any commits to your fork to be
merged back into this repository and, with attribution, be released under the terms of
the MIT License.

Contributors

主要指标

概览
名称与所有者sxalexander/jquery-scrollspy
主编程语言
编程语言 (语言数: 0)
平台
许可证
所有者活动
创建于2011-10-06 08:32:11
推送于2016-04-14 19:54:47
最后一次提交2016-04-14 12:54:47
发布数0
用户参与
星数437
关注者数22
派生数143
提交数18
已启用问题?
问题数13
打开的问题数10
拉请求数5
打开的拉请求数0
关闭的拉请求数2
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?