jquery20--animate() : 运动的方法
<!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() : 运动的方法的更多相关文章
- jquery11源码 animate() : 运动的方法
{ var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/, rfxnum = new RegExp( "^(?:([+-])=|)( ...
- JQuery动画animate的stop方法使用详解
JQuery动画animate的stop方法使用详解 animate语法: 复制代码 代码如下: $(selector).animate(styles,speed,easing,callback) 复 ...
- 如何用js自己实现Animate运动函数
js运动是我们学习js必不可少的研究部分,首先我们要知道js的运动其实仅仅是不断改变元素的某个属性值而已,比如不断改变一个绝对定位div的left值,那么你看到的效果就是这个div不断的向右边运动,那 ...
- jQuery animate动画 stop()方法详解~
一.动画格式: 格式一:jQueryObject.animate( cssProperties, options ) 格式二:$('#id').animate( styles[, duration ] ...
- jQuery animate easing使用方法
从jQuery API 文档中可以知道,jQuery自定义动画的函数.animate( properties [, duration] [, easing] [, complete] )有四个参数: ...
- 原生JS封装animate运动框架
<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8" ...
- 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() finish() 方法使用
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
随机推荐
- java高效判断素数
java高效判断素数 package solution; public class Prime { // 偶数可以由有两个素数相加得到, 一个偶数可能有多个这样的两个素数, 请寻找到 这样两个素数,让 ...
- vuejs fatherandson
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- sql server 中查询数据库下有多少张表以及同义词等信息
--查询数据库有多少张表SELECT count(0) from sysobjects where xtype = 'u' 复制代码 解释:sysobjects系统对象表. 保存当前数据库的对象.如约 ...
- bzoj 1088 [SCOI2005] 扫雷
SCOI2005 扫雷 一道很有趣的(水)题 “这道题有四种解法,你知道么” 给你矩阵的第二列的数字,求出第一列雷有多少种可能的摆法. 不懂扫雷规则的自行按win+R然后输入winmine 思考过后我 ...
- python语法学习笔记
函数的参数 定义函数的时候,我们把参数的名字和位置确定下来,函数的接口定义就完成了.对于函数的调用者来说,只需要知道如何传递正确的参数,以及函数将返回什么样的值就够了,函数内部的复杂逻辑被封装起来 ...
- 如何解决本地仓库和远程仓库的冲突(Conflict)
Background: 我有一个github仓库管理我的代码,我将这个仓库的代码clone到我的工作电脑和私人电脑本地方便我上班和在家时都可以对我的代码进行更新. 一天,我在家修改过代码之后并未提交, ...
- Android开发之Menu:OptionMenu(选项菜单)、ContextMenu(上下文菜单)、SubMenu(子菜单)
菜单的概念,现在已经很普及了.Windows系统.Mac.桌面版Linux.Java Swing等,都有可视化菜单.一.Android平台3种菜单 选项菜单(OptionMenu).上下文菜单(Co ...
- ifreq、ifconf
网络相关的ioctl请求的request参数及arg地址必须指向的数据类型如下表所示: 接口 SIOCGIFCONF SIOCSIFADDR SIOCGIFADDR SIOCSIFBRDADDR SI ...
- OpenGL之抗锯齿 以及 线宽的设置
转自原文 OpenGL之抗锯齿 以及 线宽的设置 抗锯齿 1.线的抗锯齿 glEnable(GL_LINE_SMOOTH); //启用 glHint(GL_LINE_SMOOTH,GL_NICEST) ...
- Option可选值(一)
//: Playground - noun: a place where people can play import Cocoa class Person { var residence: Resi ...