Spamsational
05-20-2012, 04:41 PM
DISCLAIMER: as you can see this is homework, I have done nearly all of it I am just stumped on the final bit and require some assistance. If you don't want to help because it is homework; please stop reading and I'm sorry I 've wasted your time.
Hey guys, just wondering if I could get some help. I am currently wondering why my button wont fade out the 'curtain' image and was also wondering how I could get the button "Open Curtains" to be replaced with "Close Curtains" when clicked (keeping in mind the "Open Curtains" should be the button intially loaded.)
What I have is as follows:
<!DOCTYPE html>
<head>
<title>Prac 10</title>
<script type="text/javascript" src="jquery.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
$(".btn1").click(function(){
$("#curtain").fadeOut();
});
$(".btn2").click(function(){
$("#transformer").fadeIn();
});
});
</script>
<style type="text/css">
#curtain
{
position:absolute;
left:10px;
}
#screen
{
position:absolute;
left:50px;
top:150px;
}
#transformer
{
position:absolute;
left:55px;
top:190px;
width:385px;
height:35%;
}
</style>
</head>
<body>
<div style="height:500px" align=center>
<img id="transformer" src="images/Transformer4.jpg" />
<img id="screen" src="images/Screen.jpg" />
<img id="curtain" src="images/Curtain.jpg" />
</div>
<div class="buttons" style="margin-left:135px">
<button class="btn1">Open Curtain</button>
<button class="btn2">Close Curtain</button>
</div>
</div>
</body>
</html>
Hey guys, just wondering if I could get some help. I am currently wondering why my button wont fade out the 'curtain' image and was also wondering how I could get the button "Open Curtains" to be replaced with "Close Curtains" when clicked (keeping in mind the "Open Curtains" should be the button intially loaded.)
What I have is as follows:
<!DOCTYPE html>
<head>
<title>Prac 10</title>
<script type="text/javascript" src="jquery.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
$(".btn1").click(function(){
$("#curtain").fadeOut();
});
$(".btn2").click(function(){
$("#transformer").fadeIn();
});
});
</script>
<style type="text/css">
#curtain
{
position:absolute;
left:10px;
}
#screen
{
position:absolute;
left:50px;
top:150px;
}
#transformer
{
position:absolute;
left:55px;
top:190px;
width:385px;
height:35%;
}
</style>
</head>
<body>
<div style="height:500px" align=center>
<img id="transformer" src="images/Transformer4.jpg" />
<img id="screen" src="images/Screen.jpg" />
<img id="curtain" src="images/Curtain.jpg" />
</div>
<div class="buttons" style="margin-left:135px">
<button class="btn1">Open Curtain</button>
<button class="btn2">Close Curtain</button>
</div>
</div>
</body>
</html>