12

how do I determine the positions in percentages?

    $(document).ready(function(){
      $("#button").toggle(function(){
        $("#slide").animate({top:-100%},1000);
      },function(){
        $("#slide").animate({top:0%},1000);
      });
    });

Please suggest.

LGVentura
  • 1,547
  • 1
  • 11
  • 17

1 Answers1

22
$(document).ready(function(){
      $("#button").toggle(function(){
        $("#slide").animate({top:'-100%'},1000);
      },function(){
        $("#slide").animate({top:'0%'},1000);
      });
    });

Add quotes. (I used single quotes, but js doesn't care if it is ' or ")

11684
  • 7,356
  • 12
  • 48
  • 71
  • 1
    @LGVentura the rule: if there is whatever else then numbers in .animate() or .css() (the first two I think o perhaps there are more) values, use quotes. – 11684 Jun 13 '12 at 13:21