https://github.com/joyent/node/blob/master/lib/multipart.js

Usage

In the <head> of your document, link both jQuery and plax.

<script type="text/javascript" src="/js/jquery.min.js"></script>
<!-- <script type="text/javascript" src="/js/ender.min.js"></script> -->
<script type="text/javascript" src="/js/plax.js"></script>

Then in your javascript, add each "layer" to the list of layers to be parallaxed. Once that's done, enable Plax and you're good to go.

$('#plax-octocat').plaxify({"xRange":40,"yRange":40})
$('#plax-earth').plaxify({"xRange":20,"yRange":20,"invert":true})
$('#plax-bg').plaxify({"xRange":10,"yRange":10,"invert":true})
$.plax.enable()

Documentation

plaxify()

Add an item to the list of parallaxing layers. Ranges are centered at the items start location. For example, an item with a 20px range will be able to move 10px forward and 10px backward from its start location.

Parameters

xRange — integer: is the distance across the x-axis the object will travel.

yRange — integer: is the distance across the y-axis the object will travel.

invert — boolean: inverting will invert the direction the object will travel across each axis.*

* The same effect can be achieved by providing xRange and yRange with negative numbers, making it possible to invert only a single axis.

enable()

Enable parallaxing.

disable()

Disable parallaxing.

posted on 2011-07-01 14:31  sleep  阅读(381)  评论(0编辑  收藏  举报