这里怎么没动画
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<style>
*{
margin: 0 ;
padding: 0;
}
ul,li{
list-style: none;
}
.box{
width:600px;
margin: 0 auto;
}
.btn li{
width:50%;
height: 100%;
text-align: center;
line-height: 50px;
background-color: #666;
color: #fff;
float: left;
cursor: pointer;
}
.con{
width:100%;
height: 500px;
background-color: red;
}
.transition {
transition: all 0.5;
}
.dz{
visibility: hidden;
opacity: 0;
}
</style>
</head>
<body>
<div class="box">
<div class="btn">
<ul>
<li class="xs">显示</li>
<li class="yc">隐藏</li>
</ul>
</div>
<div style="clear: both;"></div>
<div class="con transition dz"></div>
</div>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
var css3 = {
show : function($elem){
$elem.trigger('show');
$elem.on('transitionend',function(){
$elem.trigger('shown');;
});
$elem.show();
setTimeout(function(){
$elem.removeClass('dz');
},20);
},
hide : function($elem){
$elem.trigger('hide');
$elem.on('transitionend',function(){
$elem.hide();
$elem.trigger('hidden');
});
$elem.addClass('dz');
}
};
var $con = $('.con');
$('.xs').on('click',function(){
css3.show($con);
});
$('.yc').on('click',function(){
css3.hide($con);
});
});
</script>
</body>
</html>
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星