stop 用法
1. stop 文档
$(selector).stop(stopAll,goToEnd)
stopAll 可选。规定是否停止被选元素的所有加入队列的动画。
goToEnd 可选。规定是否允许完成当前的动画。该参数只能在设置了 stopAll 参数时使用。
2. 案例代码
<!DOCTYPE html>
<html> <head>
<meta charset="utf-8" />
<title>stop的用法案例</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
cursor: pointer;
}
#start{
margin: 20px auto;
width: 500px;
height: 50px;
line-height: 50px;
text-align: center;
border: 1px solid red;
} .button{
margin: 0 auto;
width: 1000px;
overflow: hidden;
height: 300px;
border: 1px solid red;
}
.button div{
float: left;
margin-left: 20px;
width: 200px;
height: 50px;
line-height: 50px;
border: 1px solid red;
text-align: center;
} #box {
position: relative;
margin: 20px auto;
width: 100px;
height: 100px;
background: #98bf21;
}
</style>
</head> <body>
<p id="start">start</p>
<div class="button">
<div id="button1" >stop() <br /> stop(false,false)</div>
<div id="button2" >stop(true) <br /> stop(true,false)</div>
<div id="button3" >stop(false,true)</div>
<div id="button4" >stop(true,true)</div>
</div>
<div id="box"></div> <script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(function () {
function boxMes(ele){
ele.html('width:'+ele.width()+'<br />'+'height:'+ele.height());
} $("#start").click(function () { $("#box").stop(true,true).css({
width: 100,
height: 100
});
$('#box').html('还原宽高100*100'); $("#box").animate({
width: 300,
height: 300
}, 5000,function(){
boxMes($('#box'));
});
$("#box").animate({
width: 100,
height:100
}, 5000,function(){
boxMes($('#box'));
}); }); $('#button1').click(function () {
$('#box').stop();
boxMes($('#box'));
});
$('#button2').click(function () {
$('#box').stop(true);
boxMes($('#box'));
});
$('#button3').click(function () {
$('#box').stop(false, true);
boxMes($('#box'));
});
$('#button4').click(function () {
$('#box').stop(true, true);
boxMes($('#box'));
}); }) </script>
</body> </html>
3. 总结
stop 用于阻止当前动画执行及后续动画处理(当前动画必然终止,其最终状态及绑定上的后续动画是否执行取决于两个配置组合),默认配置参数为 stop(false,false) 等同于 stop()
stop(false,false) / stop() 阻止当前动画的后续执行,同时后续动画以当前状态为初始状态 正常执行
stop(true,false) / stop(true) 阻止当前动画的后续执行,同时后续动画也不再执行,状态维持在此刻。
stop(false,true) 阻止当前动画的渐变执行(即一步执行到位),后,以当前动画的结尾状态为初始状态执行后续动画。
stop(true,true) 阻止当前动画的渐变执行(即一步执行到位),后,状态维持在此刻。
stop 用法的更多相关文章
- EditText 基本用法
title: EditText 基本用法 tags: EditText,编辑框,输入框 --- EditText介绍: EditText 在开发中也是经常用到的控件,也是一个比较必要的组件,可以说它是 ...
- jquery插件的用法之cookie 插件
一.使用cookie 插件 插件官方网站下载地址:http://plugins.jquery.com/cookie/ cookie 插件的用法比较简单,直接粘贴下面代码示例: //生成一个cookie ...
- Java中的Socket的用法
Java中的Socket的用法 Java中的Socket分为普通的Socket和NioSocket. 普通Socket的用法 Java中的 ...
- [转载]C#中MessageBox.Show用法以及VB.NET中MsgBox用法
一.C#中MessageBox.Show用法 MessageBox.Show (String) 显示具有指定文本的消息框. 由 .NET Compact Framework 支持. MessageBo ...
- python enumerate 用法
A new built-in function, enumerate() , will make certain loops a bit clearer. enumerate(thing) , whe ...
- [转载]Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法总结
本文对Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法进行了详细的总结,需要的朋友可以参考下,希望对大家有所帮助. 详细解读Jquery各Ajax函数: ...
- 【JavaScript】innerHTML、innerText和outerHTML的用法区别
用法: <div id="test"> <span style="color:red">test1</span> tes ...
- chattr用法
[root@localhost tmp]# umask 0022 一.chattr用法 1.创建空文件attrtest,然后删除,提示无法删除,因为有隐藏文件 [root@localhost tmp] ...
- 萌新笔记——vim命令“=”、“d”、“y”的用法(结合光标移动命令,一些场合会非常方便)
vim有许多命令,网上搜有一堆贴子.文章列举出各种功能的命令. 对于"="."d"."y",我在无意中发现了它们所具有的相同的一些用法,先举 ...
- [转]thinkphp 模板显示display和assign的用法
thinkphp 模板显示display和assign的用法 $this->assign('name',$value); //在 Action 类里面使用 assign 方法对模板变量赋值,无论 ...
随机推荐
- centos6安装多实例mysql
centos 6.5,使用二进制安装多实例mysql 5.5.60 所需安装包mysql-5.5.60-linux-glibc2.12-x86_64.tar.gz.ncurses-devel-5.7- ...
- MySQL5.7.25解压版安装详细教程
MySQL5.7.25解压版安装详细教程 安装步骤: 1.首先,你要下载MySQL解压版,下载地址:https://www.mysql.com/downloads/,图解: 2.解压安装包,根据自己的 ...
- 13: openpyxl 读写 xlsx文件
1.1 openpyxl 基本使用 1.openpyxl 将xlsx读成json格式 #! /usr/bin/env python # -*- coding: utf-8 -*- # -*- codi ...
- python简说(十七)操作mysql数据库
import pymysqlconn = pymysql.connect(host='118.24.3.40',user='jxz',password='123456',port=3306,db='j ...
- LVS群集配置
第一步:网络环境配置内网网段:10.0.0.0/24DR:10.0.0.254rs1:10.0.0.1rs2:10.0.0.2nfs:10.0.0.3 第二步:nfs和web服务搭建 nfs服务器:安 ...
- 学习Django,http协议,
学习Django http协议 规则 ''' http协议:超文本传输协议 ①基于TCP/IP协议基础上的应用层协议,底层实现仍为socket ②基于请求-响应模式:通讯一定是从客户端开始,服务器端接 ...
- 类中函数前、后、参数加const
1.参数加const:int fun(const int a) a在函数里不可被修改 2.函数前加const:const int* const fun() 这种一般是返回的指针或者是引用,加const ...
- QML使用的内置对象
QML从ECMAScript继承而来,所以支持这个ECMAScript.经常在QML工程中看到Math.Data.....等方法,但是在Qt手册里搜索不到,这是因为这些方法不是QtQuick的,而是E ...
- topcoder srm 692 div1 -23
1.给定一个带权有向图.选出一些边满足使得任意两点可相互到达的前提下使得选出的边的权值的最大最小差值最小. 思路:二分答案,然后枚举权值的范围判断是否可行. #include <stdio.h& ...
- Spring 学习——Spring常用注解——@Component、@Scope、@Repository、@Service、@Controller、@Required、@Autowired、@Qualifier、@Configuration、@ImportResource、@Value
Bean管理注解实现 Classpath扫描与组件管理 类的自动检测与注册Bean 类的注解@Component.@Service等作用是将这个实例自动装配到Bean容器中管理 而类似于@Autowi ...