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.

相关文章:

  • 2021-10-17
  • 2021-09-04
  • 2022-12-23
  • 2021-06-23
  • 2021-11-28
  • 2021-06-27
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案