How to hide scroll bar if an animation exceeds the browser window?

How to hide scroll bar if an animation exceeds the browser window?

Hey, I'm new to jQuery and i'm learning it from w3schools.com. I have problem is animate() function. I want an animation where a clouds enters and exits in window but when i write the code i.e 

  1.  //Cloud two 
  2.    for(var i=0;i<=1000;i++){
  3.      
  4.        $("#cld-2").animate({left:'1400'},1000);
  5.         $("#cld-2").animate({left:'-500'},1);
  6.        
  7.    }

the browser shows the horizontal scroll bar when it touches the right border of window. 
I've also also tried using css overflow attribute but that was also of no use. 



Please suggest me a solution of better code. 
Thank you!