我有一個簡單的問題,我想我解決不了簡單的JavaScript問題
下面是完整的代碼
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js" ></script>
<style type="text/css">
<!--
#content{
width:300px;
height:300px;
background-color:#FF0000;
overflow:hidden;
position: relative;
top: -300px;
}
#content1{
width:300px;
background-color:#33FF00;
height:300px;
z-index:100;
position: relative;
left: 300px;
}
#content2{
width:300px;
height:300px;
background-color:#000099;
z-index:100;
position: relative;
top: -400px;
}
-->
</style>
</head>
<body>
<script language="javascript">
function example_animate(px) {
$('#content2').animate({
'marginTop' : px
});
}
</script>
<script language="javascript">
function example_animate2(px) {
$('#content1').animate({
'marginLeft' : px
});
}
</script>
<p>
<input type="button" value="Move Up" onClick="example_animate('-=200px')" />
<input type="button" value="Move Left" onclick="example_animate2('-=300px')" />
</p>
<div id="content1"></div>
<div id="content">
</div>
<div id="content2"></div>
</body>
</html>
現在,在我需要幫助和幾件事情不知道如何他們能做到嗎? 首先,我該如何讓這兩個動畫只出現一次?
其次,綠色盒子怎麼會總是出現在藍色的盒子上?
然後,如何讓按鈕消失後點擊?。 所以當我例如點擊「上移」時,我需要那個按鈕消失。
最後,當「Move Left」被觸發時,我需要「Move Up」按鈕消失,就像「Move Left」一樣,另一方面,「Move Left」不會消失當「上移」被點擊時(「上移」只會)
這是簡單的,可以做到嗎?請幫忙!
您可能想將其分解爲單個問題。你在一個帖子中問了很多。 – JohnFx
那麼我有四件事情要實現,一件沒有另一件對我來說沒用。但是如果你能幫助其中的一個,那會很棒! –
看起來這是在我得到機會之前關閉的道路。問題是社區試圖將問題重新用於有類似問題的其他人。通過將所有這些結合在一起,並根據您的具體情況明確陳述它們,您將限制答案對您的具體案例的實用性。此外,它的措辭有點像「爲我做這件事」而不是一個常常得不到好的問題。 – JohnFx