验证中...
css3 transition 实现div宽度以中心为原点向两边伸长
Raw Copy
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>hoverSlideout Demo</title>
<style type="text/css">
.container { text-align: center; }
.bar {
width: 100px;
display: inline-block;
transition: 1s all;
/* transition: 1s all cubic-bezier(.46, 1, .23, 1.52); */
border: 1px solid #e3e3e3;
border-radius: 4px;
background-color: #ef5621;
padding: 10px 20px;
box-sizing: border-box;
}
.bar.active { width: 200px; }
</style>
</head>
<body>
<h3>css3 transition 实现div宽度以中心为原点向两边伸长</h3>
<div class="container">
<div class="bar"></div>
</div>
<script src="http://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
$('.bar').hover(function(){
$('.bar').toggleClass('active');
});
</script>
</body>
</html>

Comment list( 0 )

You need to Sign in for post a comment

Help Search

Gitee_you_jiang_zheng_wen Zheng_wen_close