jquery.animate实现弹跳效果
2016-03-07 00:00
686 查看
HTML
<!DOCTYPE html>
<html>
<head>
<link href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="https://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id='div'><a></a></div>
<div id="line"></div>
</body>
</html>
CSS
#div{
width:50px;
height:50px;
background-color:pink;
position:absolute;
top:50px;
left:100px;
border-radius:50%;
}
#line{
position:relative;
background-color:#ccc;
top:240px;
height:1px;
overflow:hidden;
}
JS
$('#div').mouseover(function(){
$('#div').animate({top:200},400,function(){
$('#div').animate({top:80},300,function(){
$('#div').animate({top:200},200,function(){
$('#div').animate({top:150},100,function(){
$('#div').animate({top:200},80,function(){
$('#div').animate({top:180},50,function(){
$('#div').animate({top:200},50);
});
});
});
});
});
});
});
<!DOCTYPE html>
<html>
<head>
<link href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="https://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id='div'><a></a></div>
<div id="line"></div>
</body>
</html>
CSS
#div{
width:50px;
height:50px;
background-color:pink;
position:absolute;
top:50px;
left:100px;
border-radius:50%;
}
#line{
position:relative;
background-color:#ccc;
top:240px;
height:1px;
overflow:hidden;
}
JS
$('#div').mouseover(function(){
$('#div').animate({top:200},400,function(){
$('#div').animate({top:80},300,function(){
$('#div').animate({top:200},200,function(){
$('#div').animate({top:150},100,function(){
$('#div').animate({top:200},80,function(){
$('#div').animate({top:180},50,function(){
$('#div').animate({top:200},50);
});
});
});
});
});
});
});
相关文章推荐
- jquery.easing
- jquery插件之jquery.extend和jquery.fn.extend的区别
- Jquery之渐变切换
- jQuery学习笔记
- 1.2 jQuery一些知识点
- 1.认识jQuery
- Jquery autocomplete-ajax自动完成例子
- 第1章 jQuery简介
- jQuery,javascript获得网页的高度和宽度
- Jquery Mobile 入门1 (介绍&组件1)
- jQuery-attr跟prop
- JQuery选择器
- HTML5开发移动web应用—JQuery Mobile(1)
- 关于jquery的ajax队列的一些问题
- jQuery简单返回顶部
- 使用jQuery设置disabled属性与移除disabled属性
- jQuery5~7章笔记 和 1~3章的复习笔记
- jquery传参PHP的回调函数无法使用$(this)的解决办法
- 使用jQuery或者原生js实现鼠标滚动加载页面新数据
- JavaScript中利用jQuery绑定事件的几种方式小结