I created a tab that opens and closes using jQuery and I'm having some problems closing it:
HTML
<div id="aba" style="position: absolute">
<img src="#"/>
<span id="fechar">X</span>
</div>
jQuery
var fechado = true;
$("#aba").click(function(){
if (fechado){
$("#aba").animate({left: "10px"});
fechado = false;
}
});
$("#fechar").click(function(){
if (fechado == false){
$("#aba").animate({left: "0px"});
fechado = true;
}
});
What happens is that when I click on close, it probably understands that it is clicking on open as well; that is, it closes and opens soon after. I tried to use a flag but unsuccessfully. The real problem is that I can not remove the close button from inside the flap.