我有這個網頁上的鼠標懸停,元素旋轉,並返回到mouseout原來的位置。使用Javascript的CSS3過渡
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
div
{
width:100px;
height:100px;
background:red;
transition:width 2s;
-moz-transition:width 2s; /* Firefox 4 */
-webkit-transition:width 2s; /* Safari and Chrome */
-o-transition:width 2s; /* Opera */
}
div:hover
{
width:300px;
}
</style>
</head>
<body>
<p><b>Note:</b> This example does not work in Internet Explorer.</p>
<div></div>
<p>Hover over the div element above, to see the transition effect.</p>
</body>
</html>
現在是否可以使用JavaScript觸發此轉換而不是使用defualt懸停功能。我嘗試創建兩個不同的類名,但即使我通過添加延遲和更改類來完成它也是可行的。無論如何,用Javascript做這樣的轉換?
你是冠軍。謝謝bazillion次,非常感謝你! – Johnydep 2011-05-31 21:53:13