百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
J

jScrollability

> 编程语言
开源

这个 jQuery 插件可帮助您构建具有复杂滚动动画的单一滚动页面。重点关注性能并支持移动设备。

100 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

这个 jQuery 插件可帮助您构建具有复杂滚动动画的单一滚动页面。重点关注性能并支持移动设备。

jScrollability

This jQuery plugin helps you build single-scroll pages with complex scroll-based animations a la the NYTimes Snowfall feature. As the user scrolls, this plugin will animate the position of items based on the scroll position. To use it, you select various page elements, set the boundary points for their behavior, and then define a functor to compute the behavior. Animations can occur continuously with progress determined by the scroll depth between two vertical points on the page so that animations occur based on the scroll rate of the user, or animations can be triggered by the the scroll depth passing a vertical point and then animating only once over a set duration.

How To Use

Option A: Single Behavior

For quick usage, you can setup jScrollability for a single element: .jScrollability(,,) or .jScrollabilityTrigger(,,).

Continuously:

sj
$('.selector').jScrollability(10,100,function($el,pcnt) {
  $el.css({
    'left': ((1 - pcnt) * 100) + '%'
  });
});

Triggered:

sj
$('.selector').jScrollabilityTrigger(10,2000,function($el,pcnt) {
  $el.css({
    'left': ((1 - pcnt) * 100) + '%'
  });
});

Option B: Groups of Behaviors

To quickly setup behaviors for multiple elements, you can use $.jScrollability().

sj
$.jScrollability([
  {
    'selector': '.slide-in-demo',
    'start': 900,
    'end': 1800,
    'fn': function($el,pcnt) {
      $el.css({
        'left': ((1 - pcnt) * 100) + '%'
      });
    }
  },
  {
    'selector': '.reveal-demo',
    'start': 1800,
    'trigger': true,
        'duration': 3000,
    'fn': function($el,pcnt) {
      $el.css({
        'top': (20 + ((1 - pcnt) * 60)) + '%'
      });
    }
  }
]);

Advanced Usage

Functor Options

Rather than passing-in a new function, you may declare a set of CSS properties, their start and end points, and the units to use so that jScrollability can compute the rest.

javascript
$('.selector').jScrollability(10,100,{
  'left': {
    'start': 100,
    'end': 0,
    'unit': '%'
  }
});

Boundary Options

Instead of setting static values for the start and end boundaries, you can also use either factors or pre-defined functors by passing strings.

Functor:

javascript
$('.selector').jScrollability(
  function($el) { return $el.offset().top; },
  function($el) { return $el.offset().top + $el.height(); },
  function($el,pcnt) {
    $el.css({
      'left': ((1 - pcnt) * 100) + '%'
    });
  }
);

Pre-defined Functors:

Also available are the self and parent functors. If you pass either of those strings, the top and bottom of either the selected element (self) or the element's parent (parent) will be used.

javascript
$('.selector').jScrollability('self','parent',function($el,pcnt) {
  $el.css({
    'left': ((1 - pcnt) * 100) + '%'
  });
});

Issues· 2 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言