Download
User Rating: 0/5 ( 0 votes)
ClassyLeaves is a plugin that will provide beautiful decorations on your website: falling and rotating interactive leaves. If you click on a leaf, it will fall; if you click on a falling leaf, magic will happen.
The plugin is crossbrowser, mobile-optimized and very easy to extend.
Source: class.pm
1. INCLUDE JS AND CSS FILES
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="js/jquery.rotate.js"></script>
<script src="js/jquery.classyleaves.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.classyleaves.min.css" />
2. JAVASCRIPT
As the last step, you create an instance of the plugin object, which you can store in a variable for later use.
var tree = new ClassyLeaves({
leaves: 30,
maxY: -10,
multiplyOnClick: true,
multiply: 2,
infinite: true,
speed: 4000
});
This way, when you want to add more leaves, you can do:
tree.add(8);
3. OPTIONS
-
leaves - number of leaves to spawn initially, default is 50
-
maxY - spread size, default is 100
-
multiplyOnClick - whether to multiply the leaf when the user clicks on it, can be true or false, default is true
-
multiply - number of images to spawn when clicking on a leaf, default is 1
-
infinite - if you want the leaves to never stop falling, can be true or false, default is true
-
speed - speed of the falling leaf animation, default is 3000
-
numImages - total number of images in the leaves folder, default is 8
-
folder - the folder containing the leaf images, default is images/leaves/