我想知道当您将鼠标悬停在元素上时,最好的方式是展开元素的大小/缩放比例:CSS或jQuery?放大/展开元素的最佳方式:CSS或jQuery
我用CSS过渡使这个fiddle,但它不会做我想做的,widht和高度没有大小光滑比例:
<div></div>
div{
width: 300px;
height: 300px;
background: #aa00aa;
-moz-transition: height 0.3s ease-in-out;
-webkit-transition: height 0.3s ease-in-out;
-o-transition: height 0.3s ease-in-out;
transition: height 0.3s ease-in-out;
-moz-transition: width 0.3s ease-in-out;
-webkit-transition: width 0.3s ease-in-out;
-o-transition: width 0.3s ease-in-out;
transition: width 0.3s ease-in-out;
}
div:hover{
background: #aa00aa;
height: 400px;
width: 400px;
}
CSS是一种这样做的更加一致和清洁方式。如果您需要与旧版浏览器保持向后兼容(只有在转换是应用程序逻辑的重要部分,而不仅仅是设计问题时),才应该考虑jQuery。 – SoonDead 2013-04-23 09:27:24