jQuery網頁飄雪代碼制作網頁飄雪背景動畫代碼



136 542 181



特效描述:飄雪 網頁飄雪代碼 網頁飄雪 背景動畫,

代碼結構

1. 引入JS

<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src='js/snowfall.jquery.js'></script>
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src='js/snowfall.jquery.js'></script>

2. HTML代碼

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>下雪動畫</title>
<style type="text/css">
html,body{padding:0;margin:0;}
.darkBg{background:#2d0f0f url(images/smashing.jpg) top center no-repeat;}
.lightBg{background:url(images/snow.jpg) #b1dde0 top center no-repeat;}
.collectonme{margin:120px auto;background:red;width:50%;text-align:center;font-size:1.2em;color:#fff;}
</style>
</head>
<body class="darkBg">
<input type="button" id="clear" value="Click to clear"/>
<input type="button" id="round" value="Rounded"/>
<input type="button" id="shadows" value="Shadows"/>
<input type="button" id="roundshadows" value="Rounded Shadows"/>
<input type="button" id="collection" value="Snow Collection"/>
<input type="button" id="deviceorientation" value="Deviceorientation"/>
<div class="collectonme">
	<p>Collect on meeeeee!!!</p>
</div>
<div class="collectonme">
	<p>Collect on meeeeee!!!</p>
</div>
<div class="collectonme">
	<p>Collect on meeeeee!!!</p>
</div>
<script type='text/javascript'> 	
$(document).ready(function(){
	$(document).snowfall();
	$("#clear").click(function(){
		$(document).snowfall('clear'); // How you clear
	});
	$("#round").click(function(){
		document.body.className  = "darkBg";
		$('.collectonme').hide();
		$(document).snowfall('clear');
		$(document).snowfall({round : true, minSize: 5, maxSize:8}); // add rounded
	});
	$("#shadows").click(function(){
		document.body.className  = "lightBg";
		$('.collectonme').hide();
		$(document).snowfall('clear');
		$(document).snowfall({shadow : true, flakeCount:200}); // add shadows
	});
	$("#roundshadows").click(function(){
		document.body.className  = "lightBg";
		$('.collectonme').hide();
		$(document).snowfall('clear');
		$(document).snowfall({shadow : true, round : true,  minSize: 5, maxSize:8}); // add shadows
	});
	$("#collection").click(function(){
		$(document).snowfall('clear');
		document.body.className  = "darkBg";
		$('.collectonme').show();
		$(document).snowfall({collection : '.collectonme', flakeCount : 250});
	});
	$("#deviceorientation").click(function(){
		$(document).snowfall('clear');
		$('.collectonme').hide();
		document.body.className  = "darkBg";
		$(document).snowfall({deviceorientation : true, round : true, minSize: 5, maxSize:8});
	});
});
</script>	
</body>
</html>



用戶評論
大牛,別默默的看了,快登錄幫我點評一下吧!:)      登錄 | 注冊


熱門標簽: 滾動切換 滾動條切換 滑動選項卡 滑動切換 選項卡切換 選項卡 切換 tab切換 頁面切換 選項卡插件 切換插件 滑動手風琴 滑動星星打分 切換按鈕 表單 表單美化 表單插件 表單美化插件 其他 背景切換 大圖切換 雪花 按鈕控制
?
×
×

注冊

官方QQ群

掃描上面二維碼加微信群

官方QQ群

jQuery/js討論群
群號:642649996
Css3+Html5討論群
群號:322131262

加群請備注:從官網了解到

老夫子电子