jQuerty not working

  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Posts: 854

Post 3+ Months Ago

It's not an unreasonable code, I can't see anything wrong with it. Anyone know what's up?
JAVASCRIPT Code: [ Select ]
$(document).ready( function(){
                     
var orb1 = $('#wrapper div:nth-child(1)')
var self = $(this)
var time1 = 2000
var time2 = 3500
                     
if(orb1.css('top') < '100%'){
   self.animate({
      top : "100%"
   }, time1);
}
else {
   orb1.animate({
      top : "0%"
             }, time2);
}
 
});
 
  1. $(document).ready( function(){
  2.                      
  3. var orb1 = $('#wrapper div:nth-child(1)')
  4. var self = $(this)
  5. var time1 = 2000
  6. var time2 = 3500
  7.                      
  8. if(orb1.css('top') < '100%'){
  9.    self.animate({
  10.       top : "100%"
  11.    }, time1);
  12. }
  13. else {
  14.    orb1.animate({
  15.       top : "0%"
  16.              }, time2);
  17. }
  18.  
  19. });
  20.  


html is fairly straightforward:
HTML Code: [ Select ]
<body>
<div id="wrapper">
<h1>Xaetrex.net</h1>
<div></div>
</div>
</body>
 
  1. <body>
  2. <div id="wrapper">
  3. <h1>Xaetrex.net</h1>
  4. <div></div>
  5. </div>
  6. </body>
  7.  

All I want to do is move the div down until it reaches a "top" property of 100%, then once it has, move it back up. I want this animation to continually loop so that the div goes back and forth for eternity. I made sure that the div has a "position" property of "relevant" so that the top property does something, but it's not working.

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 59 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.