jquery animate() stop() finish() 方法使用
<!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>Panel</title>
<style type="text/css">
*{margin:0;padding:0;}
body { font-size: 13px; line-height: 130%; padding: 60px }
#panel { width: 60px; border: 1px solid #0050D0 ;height:22px;overflow:hidden;}
.head { padding: 5px; background: #96E555; cursor: pointer;width: 300px;}
.content { padding: 10px; text-indent: 2em; border-top: 1px solid #0050D0;display:block; width:280px;}
</style>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$("button:eq(0)").click(function () {
$("#panel")
.animate({height : "150" } , 2000)
.animate({width : "300" } , 2000)
.hide(2000)
.animate({height : "show" , width : "show" , opacity : "show" } , 2000 )
.animate({height : "500"} , 2000 );
});
$("button:eq(1)").click(function () {
$("#panel").stop();//停止当前动画,继续下一个动画,当是鼠标移动hover时 ,动画和显示不同步,显示达不到预期的结果。
});
$("button:eq(2)").click(function () {
$("#panel").stop(true);//清除元素的所有动画,停止在当前状态
});
$("button:eq(3)").click(function () {
$("#panel").stop(false,true);//让当前动画直接到达末状态 ,继续下一个动画
});
$("button:eq(4)").click(function () {
$("#panel").stop(true,true);//清除元素的所有动画,让当前animate动画直接到达末状态
});
$("button:eq(5)").click(function () {
$("#panel").finish() //清除元素的所有动画,直接达到所有动画末状态
}
); })
</script>
</head>
<body>
<button>开始一连串动画</button>
<button>stop()</button>
<button>stop(true)</button>
<button>stop(false,true)</button>
<button>stop(true,true)</button>
<button>finish()</button> <div id="panel">
<h5 class="head">什么是jQuery?</h5>
<div class="content">
jQuery是继Prototype之后又一个优秀的JavaScript库,它是一个由 John Resig 创建于2006年1月的开源项目。jQuery凭借简洁的语法和跨平台的兼容性,极大地简化了JavaScript开发人员遍历HTML文档、操作DOM、处理事件、执行动画和开发Ajax。它独特而又优雅的代码风格改变了JavaScript程序员的设计思路和编写程序的方式。
</div>
</div> </body>
</html>
jquery animate() stop() finish() 方法使用的更多相关文章
- jQuery animate easing使用方法
从jQuery API 文档中可以知道,jQuery自定义动画的函数.animate( properties [, duration] [, easing] [, complete] )有四个参数: ...
- jQuery animate动画 stop()方法详解~
一.动画格式: 格式一:jQueryObject.animate( cssProperties, options ) 格式二:$('#id').animate( styles[, duration ] ...
- Jquery animate的使用方法
js: $('#colspan').click(function () { if ($('#colspan').hasClass('glyphicon-chevron-up')) { $('#cols ...
- 可用于jquery animate()方法的css属性
* backgroundPosition * borderWidth * borderBottomWidth * borderLeftWidth * borderRightWidth * border ...
- JQuery动画animate的stop方法使用详解
JQuery动画animate的stop方法使用详解 animate语法: 复制代码 代码如下: $(selector).animate(styles,speed,easing,callback) 复 ...
- jQuery animate方法开发极客标签Logo动画融合效果
在线演示 本地下载 jQuery的animate方法基础使用,演示如何生成一个jQuery animate方法开发极客标签Logo动画融合效果 相关代码录播:jQuery animate方法开发极客标 ...
- jquery animate()方法 语法
jquery animate()方法 语法 作用:animate() 方法执行 CSS 属性集的自定义动画.该方法通过CSS样式将元素从一个状态改变为另一个状态.CSS属性值是逐渐改变的,这样就可以创 ...
- jquery animate 动画效果使用解析
animate的意思是:使有生气:驱动:使栩栩如生地动作:赋予…以生命作为形容词:有生命的:活的:有生气的:生气勃勃的 先看动画效果:http://keleyi.com/keleyi/phtml/jq ...
- jquery常用函数与方法
1.delay(duration,[queueName]) 设置一个延时来推迟执行队列中之后的项目.jQuery 1.4新增.用于将队列中的函数延时执行.他既可以推迟动画队列的执行,也可以用于自定义队 ...
随机推荐
- xmind打开文件报错
可以尝试使用导入 文件——导入 选择此方式打开即可.
- sql,lambda,linq语句
实例 Code 查询Student表的所有记录. select * from student Linq: from s in Students select s Lambda: Students.Se ...
- 从国内下载Linux的CentOS系统
http://mirror.nsc.liu.se/centos-store/7.3.1611/isos/x86_64/
- 武汉Uber优步司机奖励政策
·武汉奖励前提 *必须满足当周平均评分4.7星及以上,且当周接单率70%及以上,才有资格获得奖励 *刷单和红线行为立即封号并取消当周全部奖励及车费! *从4月20日起,所有ETC和机场高速费用不参与奖 ...
- 厦门Uber优步司机奖励政策(1月4日~1月10日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- python版protobuf 安装
转自:http://www.tuicool.com/articles/VfQfM3 1. 下载protobuf源代码(当前最新版本为:2.5.0) #cd /opt #wget https://pro ...
- hive和关系型数据库
1)hive和关系型数据库存储文件的系统不同. hive使用hdfs(hadoop的分布式文件系统),关系型数据库则是服务器本地的文件系统: 2)hive使用的计算模型是mapreduce,而关系型 ...
- package.json中的devDependencies和dependencies有啥区别?
如果你的项目是发布到npm的一个包, 那么这个包的package.json中的dependencies中的依赖是会被下载下来到这个包的node_modules文件夹中的(如果你的项目本身没有这个依赖) ...
- Qt+opencv:读取、显示图像
GitHub:点击下载完整代码 本文主要是使用Qt与opencv将图像进行显示在QT界面上. 程序运行后的界面如下所示: (由于只有打开图像之后,才能对图像进行翻转,所以程序设置为读取图像成功之后才能 ...
- 【Python 开发】第一篇:计算机基础
一.计算机基础 首先Python是一门编程语言 语言: 那什么是语言? 语言就是一种事物与另一种事物沟通的介质.所以说编程语言是程序员跟计算机沟通的介质. 什么是编程: 准确来说就是程序员用计算机所能 ...