what i am trying to do is when i click the div it decreases to width=100px and when i click it again it changes it to original size but i am getting the problem in the second part where i want to re size it to original size i known i got the problem in using
animate()
method in
if
statement.can someone fix this problem for and correct my syntax for
animate()
method in
if
statement.
code is below
else part is not working
<script type="text/javascript">
$(document).ready(function(){
$("#testing").css('border','1px solid #f00');
$("#testing").css('height','100px');
$("#testing").css('width','800px');
$("#testing").click(function(){
if($("#testing").css('width') == ('800px'))
{
$("#testing").css('border','1px solid #f00');
$("#testing").css('height','100px');
$("#testing").animate({'width':'100px'});
}else
if($("#testing").animate('width') == ('100px'))
{
$("#testing").css('border','1px solid #f00');
$("#testing").css('height','100px');
$("#testing").animate({'width':'800px'});
}
});
});
</script>