jquery.scrollfx是一款可以制作页面滚动元素动画效果的jQuery插件

jquery.scrollfx是一款可以制作页面滚动元素动画效果的jQuery插件。通过该插件,用户在滚动页面的时候,可以改变文字的大小以及背景颜色的透明度等,制作出很酷的效果。

JavaScript 网页滚动

详细介绍

jquery.scrollfx

A jQuery plugin that adds some cool effects when a user scrolls down the page.

What is basically does is calculate the distance from the top to bottom of the selector when the user has scrolled down to determine how the selector should change it's appearance with CSS attributes.

I wrote the plugin for a private project, but I thought why not share it with the world.

If you want to see a working example visit http://marksten.github.io/jquery.scrollfx

NOTE: This plugin is currently in development.

Installation

NPM

npm install jquery.scrollfx --save

Manually

Find jquery.scrollfx.js in the root directory. Make sure to include it after jQuery.

Usage

$(selector).scrollFx(function() {
  scaleElements:    '',   // required
  opacityElements:  '',   // required
  precision:        ''    // optional
});

Options

Here is a list of all available options.

scaleElements (string, default: '')

The elements that should be scaled inside of the wrapper. Joined with a ','.

opacityElements (string, default: '')

The elements that should change their opacity attribute. Joined with a ','.

precision (integer, default: 10)

This option effects the overall performance of your website. The higher the precision, the 'smoother' the effects. If you don't want to overheat your users' GPU or CPU your should reduce this number.

Compatibility

This plugin has been tested on Google Chrome, Safari (retina display) and on an iPhone6.