JQury中设置元素自定义动画animate方法
来源:互联网 发布:ssh 端口修改 编辑:程序博客网 时间:2024/05/23 01:58
jQuer中animate() 方法用于创建自定义动画,语法为:
animate({params},speed,callback);
其中params为必须属性,其它两个则为可选的属性。
params参数定义形成动画的 CSS 属性,即直接写元素的CSS属性;
speed 参数规定效果的时长,它可以取以下值:"slow"、"fast" 或毫秒;
callback 参数是动画完成后所执行的函数名称。
值得注意的是,HTML的元素都是静止的,要让其运动则先设定其position位置,如下列:
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head>
<script src="/jquery/jquery-1.11.1.min.js">
</script>
<script>
$(document).ready(function(){
$("#button1").click(function(){
$("div").animate({left:'100px',opacity:'0.5',top:'100px',height:'+=100px'},3000);
});
$("#button2").click(function(){
$("div").stop();
});<!-- stop()表示停止当前的一切活动,包括滑动、淡入淡出和自定义动画动等。-->
});
</script>
</head>
<body>
<button id="button1">开始动画</button><button id="button2">停止动画</button>
<div style="background:red;height:100px;width:100px;position:relative;"></div>
</body>
</html>
0 0
- JQury中设置元素自定义动画animate方法
- JQury中设置元素滑动(slideUp/slideDown/slideToggle)方法
- JQuery自定义动画animate方法
- JQuery自定义动画animate方法
- JQury中设置元素淡入淡出(fadeIn/fadeOut/fadeToggle/fadeTo)以及显示隐藏(show/hide)方法
- jQury animate操作 background-position 方法
- jQuery 效果 - animate() 方法 自定义动画效果
- 8.jquery animate方法自定义动画
- 4.2.4: jQuery动画之自定义动画方法animate()
- jquery自定义动画-animate()
- jquery自定义动画animate()
- jquery自定义动画animate()
- jq 自定义动画animate
- JQuery 自定义动画( animate() )
- jQuery自定义动画函数animate() easing: "easeInOutCirc"导致的animate()动画抖动问题解决方法
- jQuery动画---自定义动画animate()
- jQuery 动画 - animate() 方法
- animate() 方法执行 CSS 属性集的自定义动画。
- UITableView练习二之Dynamic Prototypes练习
- shell加密工具shc的安装和使用
- Android 布局优化
- android布局属性详解
- 时间选择器TimePickerDialog
- JQury中设置元素自定义动画animate方法
- iOS Block 的具体使用
- mac快捷键总结
- 单例设计模式
- 会话的四种跟踪技术
- leetcode之Best Time to Buy and Sell Stock II
- Android Studio快捷键
- MySQL 时间和日期函数
- 使用stl for_each的三种方法