我有一个简单的问题,我想我解决不了简单的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