jquery实现显示和隐藏toggle()方法的使用

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>demo1--简单动画实现</title>
<style>
#box1 { background:#98bf21;height:500px;width:500px;position:absolute;display:none;}
</style>
<script src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
/*$(function(){
$("#box1").show(function(){
$(this).animate({width:'500px',height:'500px',opacity:'0.4'},1000);
$(this).animate({width:'0px',height:'0px',opacity:'0.4'},1000);
});
});*/
$(function(){
$("#box1").toggle(2000);
$("#box1").toggle(2000);
});
</script>
</head>
<body>
<div id="box1"></div>
</body>
</html>

 

posted @ 2016-07-06 10:21  hxiuping  阅读(716)  评论(0编辑  收藏  举报