jQuery animation + core functions

1. Animation
1.show() shows.hide() hides
can wear parameters

$("#btn1").on("click",function(){
$("#app").show();
})
$("#btn2").on("click",function(){
$("#app").hide("slow");
})
You can also set the number, how many seconds to disappear after, what changes is the value of width and height and opcity
1. opcity css property transparency
2.fadeIn() fadeOut() sets the fade effect


$("#btn1").on("click",function(){
$("#app").fadeIn(2000);
})
$("#btn2").on("click",function(){
$("#app").fadeOut(3000);
})
The unit of the parameter is milliseconds = 0.001s
3.slideDown() slideUp()
$("#btn1").on("click",function(){
$("#app").slideDown(2000);
})
$("#btn2").on("click",function(){
$("#app").slideUp(3000);
})

4. .animate()

$("#btn3").on("click",function(){
$("#app").animate({
width:100,
height:100,
opcity:0.5,

},3000,function(){
alert("Finished")
})
})
The first parameter is the style after the change, the second is the change event, and the third is the action after the end
1.
$("#app").animate({
width:'+=20',
height:400,
opcity:0.5,

},3000,function(){
alert("Finished")
}}
You can pass a parameter, how much to add or how much to subtract at a time
2.$("#app").animate({
width:300,
// height:400,
// opcity:0.5,

},3000).animate({
height:300,
},3000)
先执行一个动画再执行一个动画,否则是一起执行的。
4..stop()

$("#btn4").on("click",function(){
$("#app").stop(false,false);
})
1.第一个参数设置为true的时候,全部动画都会停止
2.第二个设置为true的时候,会直接到达第一个动画的终点之后直接开始第二个动画
二 核心函数

1.extend()

var o1 = {
sex:'nan',
age:4
}
var o2 = {
name:'zhao',
age:3
}
var o3 =$.extend(o1,o2);
console.log(o3);
把o2合并到o1;
2..each(function(index){
})

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325442626&siteId=291194637