I've firgured out the problem but am not able to fully resolve it.
Because I am appending the close button to the div I am trying to modify, I am still technically clicking the div, so it runs what the close button should do, but also the original action of what should happen when I click the div.
The thing is I want the close button on the corner of the div but not sure how to put it there without absolutly positioning it. any ideas?
Basically it works fine if it put the button outside of the div.
my code now:
Code:
.card-wallet{position:absolute; top:0; left:0; background:#eee; width:650px; height:230px;}
.card{padding:20px 0 0 20px; width:310px; height:185px; position:relative;}
.close-card{display:none; position:absolute; top:2px; right:-56px; background:url(img/hide-close.png) no-repeat top left; width:85px; height:26px; cursor:pointer; text-indent:-98765px; line-height:0; font-size:0;}
.close-card:hover{background-position:bottom left;}
Code:
<div class="card-wallet">
<div class="card">
card content
</div><!-- /.card -->
<span class="close-card">Close</span>
</div><!-- /.card-wallet -->
Code:
$('.card').css({"margin-top":"-150px",}, 1000);
$('.card').click(function(){
$(this).animate({"margin-top":"15px",}, 700, function() {// Animation complete.
$(this).css({"z-index":"400"});
$(this).animate({"margin-top":"-130px",}, 700, function() {
$('.close-card').show();
});
});
});
$('.close-card').click(function(){
$('.card').stop().animate({"margin-top":"15px",}, 700, function() {// Animation complete.
$('.card').css({"z-index":"1"});
$('.close-card').hide();
});
$('.card').animate({"margin-top":"-150px",}, 700);
});
Bookmarks