<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#tempc {
background-color: #FFFF00;
width: 50px;
height: 50px;
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
function toggle(){
$("#tempc").toggle(
function() {
$("#tempc").animate({width: 255, height: 300}, 1000, "easeInOutQuad")
},
function() {
$("#tempc").animate({width: 50}, 1000, "easeInOutQuad")
}
);
}
</script>
</head>
<body>
<div id="tempc" onclick="toggle();">
Hello!
</div>
</body>
</html>
你好#1, 我嘗試使用切換動畫中的功能切換,但代碼showen上面似乎沒有工作?哪裏不對?的Javascript jQuery的動畫,切換,不能正常工作
問候
jQuery的「切換」功能是用於設置該交替響應點擊處理程序。這段代碼看起來像是在單擊元素後嘗試設置這些處理程序。那是你要的嗎? – Pointy 2011-01-31 14:10:57
@點,不! 'hover(fn,fn)'這樣做。 – Cybrix 2011-01-31 14:12:21