<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style>
#div1{ width:200px; height:200px; background:red; display:none;}
</style>
<script src="jquery-2.0.3.js"></script>
<script> 定义一些变量
tweeners = {}; √
function createFxNow(){} √
function createTween(){} √
function Animation(){} √
function propFilter(){} √
jQuery.Animation = jQuery.extend( Animation, { √
tweener
prefilter
});
function defaultPrefilter(){} √
function Tween(){} √
Tween.prototype = { √
init
cur
run
};
Tween.propHooks = {}; √
jQuery.each([ "toggle", "show", "hide" ], function(){}); √
jQuery.fn.extend({
fadeTo √
animate √
stop √
finish √
});
function genFx(){} √
jQuery.each({ √
slideDown
slideUp
slideToggle
fadeIn
fadeOut
fadeToggle
}, function() {});
jQuery.speed = function(){}; √
jQuery.easing = { √
linear
swing
};
jQuery.timers = []; √
jQuery.fx.tick = function(){}; √
jQuery.fx.timer = function(){}; √
jQuery.fx.interval = 13; √
jQuery.fx.start = function(){}; √
jQuery.fx.stop = function(){}; √
jQuery.fx.speeds = {}; √*/ show
hide
toggle
slideDown
slideUp
slideToggle
fadeIn
fadeOut
fadeToggle
fadeTo $(function(){ $('input').click(function(){ $('#div1').hide(1000); //改变width height opacity
$('#div1').show(1000); //改变width height opacity
$('#div1').toggle(1000);
$('#div1').slideUp(1000);//向上收起
$('#div1').slideDown(1000);//向下展开
$('#div1').slideToggle(1000); //height
$('#div1').fadeIn(1000,0.5);
$('#div1').fadeOut(1000,0.5);
$('#div1').fadeToggle(1000); //opacity //宽度变成400,执行时间,linear匀速的,回调
$('#div1').animate({ width : 400 },4000,'linear',function(){
alert(123);
});
$('#div1').animate({ width : 'hide' , height : 'hide' , opacity : 'hide' },1000,'linear',function(){
alert(123);
}); $('#div1').animate({ height : 'toggle' },1000,'linear',function(){
alert(123);
});
$('#div1').fadeTo(1000,0.5);
$('#div1').animate({ opacity : 0.5 },1000,'linear',function(){
});
});
});
</script>
</head> <body>
<input type="button" value="点击">
<div id="div1"></div>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style>
#div1{ width:200px; height:200px; background:red; position:absolute;}
</style>
<script src="jquery-2.0.3.js"></script>
<script>
$(function(){
$('input').click(function(){
//3个入队操作fx
$('#div1').animate({ width : 300 },1000);
$('#div1').animate({ height : 300 },1000);
$('#div1').animate({ left : 300 },1000);
}); //jQuery.fx.off = true; //关闭页面所有的运动
$('input').click(function(){
$('#div1').animate({ opacity : 0.5 },1000,'linear',function(){
});
//配置写运动
$('#div1').animate({ width : 400 },{
duration : 'slow', //速度慢速
easing : 'linear', //匀速
complete : function(){ //完成回调
alert(111);
}
});
});
});
</script>
</head> <body>
<input type="button" value="点击">
<div id="div1"></div>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style>
#div1{ width:20px; height:200px; background:red; position:absolute;}
</style>
<script src="jquery-2.0.3.js"></script>
<script>
$(function(){
$('input').click(function(){
$('#div1').animate({ width : '50%' },2000);//屏幕的一半,tweeners处理的
$('#div1').animate({ width : '+=200' },2000);
$('#div1').animate({ 'marginLeft' : 200 },2000); //margin-left -> marginLeft $('#div1').animate({ 'margin' : 200 },2000); //marginLeft marginTop marginBottom marginRight $('#div1').animate({ 'width' : [200,'linear'] , 'height' : [20,'swing'] },2000); $('#div1').animate({ 'width' : 200 , 'height' : 20 },{ specialEasing : {
'width' : 'linear',
'height' : 'swing'
} }); }); }); </script>
</head> <body>
<input type="button" value="点击">
<div id="div1"></div>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style>
#div1{ width:100px; height:100px; background:red; position:absolute;}
</style>
<script src="jquery-2.0.3.js"></script>
<script>
$(function(){
$('input').click(function(){
$('#div1').animate({ 'width' : 300 },{
queue : false
}).animate({ 'height' : 300 },{}); $('#div1').animate({ 'width' : 300 },5000); $('#div1').animate({ 'width' : 300 },{
step:function(A){
CONSOLE.LOG(A);//每次位置的变化值
}
done : function(){
console.log(123);
}
});
});
}); </script>
</head> <body>
<input type="button" value="点击">
<div id="div1"></div>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style>
#div1{ width:100px; height:30px; background:red; }
#div2{ width:100px; height:30px; background:red; margin-top:20px;}
#div3{ width:100px; height:30px; background:red; margin-top:20px;}
</style>
<script src="jquery-2.0.3.js"></script>
<script>
$(function(){
$('input').click(function(){
$('#div1').animate({width : 500} , 2000 , 'linear');
$('#div2').animate({width : 500} , 2000 , 'swing');
$('#div3').animate({width : 500} , 2000 , 'miaov');
});
}); </script>
</head> <body>
<input type="button" value="点击">
<div id="div1"></div>
<div id="div2"></div>
<div id="div3"></div>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style>
#div1{ width:100px; height:100px; background:red; }
#div2{ width:100px; height:30px; background:red; margin-top:20px;}
#div3{ width:100px; height:30px; background:red; margin-top:20px;}
</style>
<script src="jquery-2.0.3.js"></script>
<script>
$(function(){
$('input').eq(0).click(function(){
$(document.documentElement).animate({ scrollTop : 600 },2000);
$('#div1').animate({ width : 300 },2000).animate({ height : 300 },2000);
}); $('input').eq(1).click(function(){
$(document.documentElement).animate({ scrollTop : 600 },2000);
$('#div1').stop(); //默认的,停止当前运动,不会影响队列的后续运动
$('#div1').stop(true);//后面运动也停止
$('#div1').stop(true,true); //会停止立即转到当前运动的结束位置
$('#div1').finish();//会停止立即转到所有运动的结束位置
});
}); </script>
</head> <body style="height:2000px;">
<input type="button" value="点击"><input type="button" value="停止运动">
<div id="div1"></div>
</body>
</html>

jquery20--animate() : 运动的方法的更多相关文章

  1. jquery11源码 animate() : 运动的方法

    { var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/, rfxnum = new RegExp( "^(?:([+-])=|)( ...

  2. JQuery动画animate的stop方法使用详解

    JQuery动画animate的stop方法使用详解 animate语法: 复制代码 代码如下: $(selector).animate(styles,speed,easing,callback) 复 ...

  3. 如何用js自己实现Animate运动函数

    js运动是我们学习js必不可少的研究部分,首先我们要知道js的运动其实仅仅是不断改变元素的某个属性值而已,比如不断改变一个绝对定位div的left值,那么你看到的效果就是这个div不断的向右边运动,那 ...

  4. jQuery animate动画 stop()方法详解~

    一.动画格式: 格式一:jQueryObject.animate( cssProperties, options ) 格式二:$('#id').animate( styles[, duration ] ...

  5. jQuery animate easing使用方法

    从jQuery API 文档中可以知道,jQuery自定义动画的函数.animate( properties [, duration] [, easing] [, complete] )有四个参数: ...

  6. 原生JS封装animate运动框架

    <!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8" ...

  7. Jquery animate的使用方法

    js: $('#colspan').click(function () { if ($('#colspan').hasClass('glyphicon-chevron-up')) { $('#cols ...

  8. 可用于jquery animate()方法的css属性

    * backgroundPosition * borderWidth * borderBottomWidth * borderLeftWidth * borderRightWidth * border ...

  9. jquery animate() stop() finish() 方法使用

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

随机推荐

  1. springboot shiro配置

    导入相关包(这里配合使用Ehcache缓存) <dependency> <groupId>org.apache.shiro</groupId> <artifa ...

  2. spring boot actuator工作原理之http服务暴露源码分析

    spring boot actuator的官方文档地址:https://docs.spring.io/spring-boot/docs/current/reference/html/productio ...

  3. Java 类和对象12

    构造一辆汽车,油箱容量100L,当前里程数0,当前油量0,可以根据道路状况确定油耗,根据行驶速度与行驶时间, 输出当前油量与总里程数. public class Car_1 { // 车牌 priva ...

  4. Android EditText+ListPopupWindow实现可编辑的下拉列表

    使用场景 AutoCompleteEditText只有开始输入并且与输入的字符有匹配的时候才弹出下拉列表.Spinner的缺点是不可以编辑.所以本文介绍如何使用EditText+ListPopupWi ...

  5. Android框架-Volley(一)

    1. Volley简介 我们平时在开发Android应用的时候不可避免地都需要用到网络技术,而多数情况下应用程序都会使用HTTP协议来发送和接收网络数据.Android系统中主要提供了两种方式来进行H ...

  6. iview 分页的案例

    //html部分 //js部分

  7. tomcat web容器工作原理

    Tomcat的模块结构设计的相当好,而且其Web 容器的性能相当出色.JBoss直接就使用了Tomcat的web容器,WebLogic的早期版本也是使用了Tomcat的代码.Web容器的工作过程在下面 ...

  8. ubuntu 18.04网卡命名规则改回传统的ethx

    自15版本开始网卡命名规则就不叫eth0了.而是用可预期网络接口设备名称的命名规则,比如网卡名为enp3s0 . 如果想要变回ethx也是可以的,参考以下步骤: 1.编辑/etc/default/gr ...

  9. echarts 总结:

    options配置项: title: 图表标题的配置 tooltip: 鼠标悬浮的提示 toolbox: 工具栏 series: 数据项,是每一个个的数据对象,可以根据type配置每一项数据的图例. ...

  10. ubuntu18.04安装dash-to-dock出错的问题

    之前在安装dash-to-dock出现了这种错误: TypeError: ExtensionUtils.initTranslations is not a function Stack trace:i ...