jquery动画显示效果
2016-07-18 19:52
453 查看
1.布局设置
<body>
<button >动画演示</button>
<div style="width:86px; height:68px; background-color:pink;position:absolute; top: 80px; left: 7px;"></div>
</body>
2.函数设置:单击button按钮进行动画显示效果
<script src="Script/jquery-1.7.1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("button").click(function () {
$("div").animate({left:'250px'});
});
});
</script>
3.全部html如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="Script/jquery-1.7.1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("button").click(function () {
$("div").animate({left:'250px'});
});
});
</script>
</head>
<body>
<button >动画演示</button>
<div style="width:86px; height:68px; background-color:pink;position:absolute; top: 80px; left: 7px;"></div>
</body>
</html>
附加其他几种效果:看注释
<script type="text/javascript">
$(document).ready(function () {
$("button").click(function () {
// $("div").animate({left:'250px'}); //划到距离左侧250px
//$("div").animate({ height: 'toggle' })//上下高度滑动
//$("div").animate({ width: 'toggle' }); //左右宽度滑动
var div = $("div");
div.animate({ width: '400px', opacity: '0.4' }, "slow");
div.animate({ height: '300px', opacity: '0.9' }, "slow");
div.animate({ width: '300px', opacity: '0.7' }, "slow");
div.animate({ height: '233px', opacity: '0.2' }, "fast");
});
});
<body>
<button >动画演示</button>
<div style="width:86px; height:68px; background-color:pink;position:absolute; top: 80px; left: 7px;"></div>
</body>
2.函数设置:单击button按钮进行动画显示效果
<script src="Script/jquery-1.7.1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("button").click(function () {
$("div").animate({left:'250px'});
});
});
</script>
3.全部html如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="Script/jquery-1.7.1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("button").click(function () {
$("div").animate({left:'250px'});
});
});
</script>
</head>
<body>
<button >动画演示</button>
<div style="width:86px; height:68px; background-color:pink;position:absolute; top: 80px; left: 7px;"></div>
</body>
</html>
附加其他几种效果:看注释
<script type="text/javascript">
$(document).ready(function () {
$("button").click(function () {
// $("div").animate({left:'250px'}); //划到距离左侧250px
//$("div").animate({ height: 'toggle' })//上下高度滑动
//$("div").animate({ width: 'toggle' }); //左右宽度滑动
var div = $("div");
div.animate({ width: '400px', opacity: '0.4' }, "slow");
div.animate({ height: '300px', opacity: '0.9' }, "slow");
div.animate({ width: '300px', opacity: '0.7' }, "slow");
div.animate({ height: '233px', opacity: '0.2' }, "fast");
});
});
相关文章推荐
- ajaxFileUpload 报这错jQuery.handleError is not a function
- jQuery
- jquery validate 比较两个input输入框的值的大小
- jQuery——遍历
- jquery.cookie插件的方法使用注意点
- JQueryUi模糊搜索
- 使用jquery获取radio的值
- jquery ajax自动生成表格table基础
- jQuery 实现下拉导航 二级导航
- jQuery某网站品牌列表效果
- jQuery实现滚动公告练习
- jquery倒计时过几秒页面跳转 js倒计时
- jQuery实现仿微博发布框字数提示
- jQuery自制提示框tooltip
- jQuery的deferred对象详解
- jQuery实现表格的查看修改删除
- jquery 经常用到的并且需要注意的地方。
- jquery $.each 用法
- 使用jQuery的插件qrcode生成二维码(静态+动态生成)及常见问题解决方法
- jquery实现倒计时60秒发送邮件