841天 南柯一梦

忠于理想 面对现实

为博客添加烟花代码特效教程

发布于 1年前 / 599 次围观 / 2 条评论 / 资源分享 / 南柯一梦

    首先预祝大家新年康乐,身体健康,万事如意! 还有两天就要过年了,想给网站添加一点年味,特意在百度上搜了一个,分享给大家

123.png

Start

必需文件jQuery 核心库 没有的自行添加

下面就直接添加本站这里的代码即可

<link rel="stylesheet" href="https://www.nkymbk.cn/content/templates/FLY/css/jquery-ui.css" />
<script src="https://www.nkymbk.cn/content/templates/FLY/js/firemaks.js" type="text/javascript"></script>
<script type="text/javascript">
var cx = 0,cy = 0;
var color1 = new Array( new Array({r:241,g:0,b:0},  {r:255,g:72,b:72},  {r:239,g:107,b:107},  {r:255,g:191,b:191},  {r:255,g:255,b:255}),
new Array({r:12,g:152,b:228},  {r:81,g:188,b:246},  {r:100,g:195,b:247},  {r:195,g:232,b:252},  {r:255,g:255,b:255}),
new Array({r:202,g:228,b:12},  {r:226,g:246,b:81},  {r:229,g:247,b:100},  {r:245,g:252,b:195},  {r:255,g:255,b:255}) );
var color2 = new Array( new Array({r:255,g:0,b:0}, {r:228,g:225,b:0}, {r:169,g:0,b:231}, {r:255,g:0,b:148}, {r:255,g:255,b:255}),
new Array({r:0,g:153,b:231}, {r:194,g:0,b:231}, {r:255,g:118,b:0}, {r:141,g:227,b:0}, {r:255,g:255,b:255}), 
new Array({r:255,g:251,b:125}, {r:0,g:206,b:223}, {r:247,g:154,b:255}, {r:255,g:165,b:106}, {r:255,g:255,b:255}) );
var color3 = new Array( new Array({r:0,g:94,b:226}, {r:255,g:255,b:255}),
new Array({r:231,g:234,b:0}, {r:255,g:255,b:255}), 
new Array({r:255,g:109,b:0}, {r:255,g:255,b:255}) );
var color4 = new Array(
	new Array({r:255,g:0,b:0}),
	new Array({r:0,g:94,b:226}),
	new Array({r:214,g:214,b:214}),
	new Array({r:0,g:168,b:0}),
	new Array({r:231,g:234,b:0}),
	new Array({r:255,g:118,b:0}),
	new Array({r:0,g:205,b:255}),
	new Array({r:182,g:255,b:125}),
	new Array({r:255,g:0,b:123})	
	);
	

jQuery(document).ready(function(){
    //	
    $('body').firemaks({
		color: 'random',
		type: 'random',
		color_child: 'inherit',
		type_child: 'random',
		boom_count: 3
		});
	
	$(document).mousemove(function(e){ cx = e.pageX; cy = e.pageY; });	
	$('body').on('click',function(){ $('body').firemaks('fire',cx,cy,40,color1/*'full_random'*/,2,1.5); });
	
	
	//	
	$('#typeset').buttonset();
	$('#typeset input').on('click', function(){ settype ($(this).val(), $(':radio[name=typeset_child]').filter(':checked').val()); });
	$('#typeset_child').buttonset();
	$('#typeset_child input').on('click', function(){ settype ($(':radio[name=typeset]').filter(':checked').val(), $(this).val()); });
	
	function settype(val, val2) {
        var vl1 = null, vl2 = null;
		switch (val){
            case '0': vl1 = 'random'; break;
            case '1': vl1 = 1; break;
            case '2': vl1 = 2; break;
            case '3': vl1 = 3; break;
            default: vl1 = 'random'; break;
			}		
		switch (val2){
            case '0': vl2 = 'random'; break;
            case '1': vl2 = 1; break;
            case '2': vl2 = 2; break;
            case '3': vl2 = 3; break;
			case '4': vl2 = 'inherit'; break;
            default: vl2 = 'random'; break;
			}
		$('body').firemaks('settypes', vl1, vl2);			
        }
		

});
</script>
未显示?请点击刷新
  1. 1年前 (2018-02-14)
    @

    额 我要弄到我博客去

    • 1年前 (2018-02-14)
      @ NO

      @苏晓晴:我昨晚想给你弄来着,不知道你后台密码。