jQuery插件

easing插件(动画插件)

jQuery的动画一般默认是一个匀速动画,easing是jQuery的一个插件,使用它可以创建更加绚丽的动画效果。

	//最终样式,动画时间,easing效果,回调函数
	$('.car').animate({"left":"150%"},6000,"easeInElastic",function(){
		//回调函数
	});
easing支持的动画效果

在这里插入图片描述

stellar插件(视差滚动插件)

  1. 首先设置背景图片为固定定位
  2. 引用jQuery.js
  3. 引用stellar.js

demo:

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="js/jquery.min.js"></script>
		<script src="js/jquery.stellar.min.js"></script>
		<style>
			body {
				font-size: 20px;
				color: white;
				text-shadow: 0 1px 0 black, 0 0 5px black;
			}
			
			p {
				padding: 0 0.5em;
				margin: 0;
			}
			
			
			#content1 {
				background: url("img/1.jpg") no-repeat fixed;
				background-size: 100% 100%;
			}
			
			#content2 {
				background: url("img/2.jpg") no-repeat fixed;
				background-size: 100% 100%;
			}
			
			#content3 {
				background: url("img/3.jpg") no-repeat fixed;
				background-size: 100% 100%;
			}
			
			#content4 {
				background: url("img/4.jpg") no-repeat fixed;
				background-size: 100% 100%;
			}
		</style>
	</head>
	<body>
		<div class="content" id="content1" data-stellar-background-ratio="0.3">
			<p>TEXT HERE</p>
		</div>
		<div class="content" id="content2" data-stellar-background-ratio="0.3">
			<p>TEXT HERE</p>
		</div>
		<div class="content" id="content3" data-stellar-background-ratio="0.3">
			<p>TEXT HERE</p>
		</div>
		<div class="content" id="content4" data-stellar-background-ratio="0.3">
			<p>TEXT HERE</p>
		</div>
		<script>
			$(function() {
				//设置每一个div的高度为当前屏幕的高度
				$('.content').height($(window).height());
				
				$.stellar({
					horizontalScrolling:false,
					responsive:true
				})
			})
		</script>
	</body>
stellar插件详细参数
名称说明
horizontalScrolling 和 verticalScrolling该配置项用来设置视差效果的方向。horizontalScrolling设置水平方向,verticalScro设置垂直方向, 为布尔值,默认为true
responsive该配置项用来制定load或者resize时间触发时是否刷新页面,其值为布尔值,默认为false
hideDistantElements该配置项用来设置移出视线的元素是否隐藏,其值为布尔值,若不想隐藏则设置为false`
data-stellar-ratio=“2”定义了此元素针对页面滚动的速度比率,比如,0.5为页面滚动的50%,2为页面滚动的200%,所以数值越大,你可以看到页面元素滚动速度越快。
data-stellar-background-ratio该配置项用在单个元素中,其值为一个正数,用来改变被设置元素的影响速度。 例如 值为0.3时,则表示背景的滚动速度为正常滚动速度的0.3倍。如果值为小数时最好在样式表中设置
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值