Could someone please have a look at this and tell me what I'm doing wrong. It's a span with class move.up on click the .content-wrapper element will move and the .move.up wil change class name to .move.dwn
later the move.dwn.click(function() should start but I can never make it to that point, why?
<style type="text/css">
.content-wrapper {
height:100px;
width:100px;
background-color:orange;
position:relative;
}
span.move {
background-color:fuchsia;
cursor:pointer;
}
</style>
<span class="move up">click here</span>
<div class="content-wrapper"></div>
<script type="text/javascript">
$(document).ready(function() {
$('.move.up').click(function() {
alert("up");
$('.content-wrapper').animate({'left': '+=568px'}, 'slow');
$(this).removeClass('up');
$(this).addClass('dwn');
});
$('.move.dwn').click(function() {
alert("dwn");
$('.content-wrapper').animate({'left': '-=568px'}, 'slow');
$(this).removeClass('dwn');
$(this).addClass('up');
});
});
</script>