jQuery雪花插件JQuery-Snowfall Plugin


明天就是聖誕節,分享一個好玩的jQuery插件——JQuery-Snowfall Plugin,該插件可以實現在頁面上飄落雪花的特效。

JQuery-Snowfall插件的github項目地址:https://github.com/loktar00/JQuery-Snowfall/

調用插件的方式很簡單,首先,需要在頁面上添加對js源文件snowfall.jquery.js的引用:

<script type="text/javascript" src="https://raw.githubusercontent.com/loktar00/JQuery-Snowfall/master/src/snowfall.jquery.js"></script>

然后使用插件的缺省方式開啟雪花特效:

$(document).snowfall();

 

此外,該插件還支持下列參數設置:

1、flakeCount,

2、flakeColor,

3、flakeIndex,

4、minSize,

5、maxSize,

6、minSpeed,

7、maxSpeed,

8、round, true or false, makes the snowflakes rounded if the browser supports it.

9、shadow true or false, gives the snowflakes a shadow if the browser supports it.

示例用法:

$(document).snowfall({flakeCount : 100, maxSpeed : 10});

或者:

$('#element').snowfall({flakeCount : 800, maxSpeed : 5, maxSize : 5});

清除雪花:

$('#element').snowfall('clear');

使用圖片作為雪花元素:

$(element).snowfall({image :"images/flake.png", minSize: 10, maxSize:32});

另外,該插件也支持無需jQuery即可使用的純JavaScript版本。

原文鏈接:http://bookshadow.com/weblog/2014/12/24/jquery-snowfall-plugin/
請尊重作者的勞動成果,轉載請注明出處!書影博客保留對文章的所有權利。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM