Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
Javascript - Flow side to side.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="NSA" data-source="post: 325985" data-attributes="member: 10034"><p>Hi all!</p><p>I'm trying to get a div to move from the left hand side of the screen to the right, back to the left and repeat.</p><p>Now, this would be easy to do using jQuery's animate function, however... I want to be able to clone the current moving element, have it stop in its current position and the newly cloned element to carry on from where the old element was. Now, again this is fine with animate, however, with the functions set time to finish animation, once I call animate on the new element, even if it's like... 2px from the right hand side of the screen, it still takes the full length to finish. So, I tried doing it with a loop and it "kind of works". The element moves from the left, to the right and glitches out when it tries to go back to the right hand side. If anybody could take a look and see what the problem is, I'd appreciate it because I'm stuck. You can see my current code here: <a href="http://welfordian.com/game/" target="_blank">http://welfordian.com/game/</a> but please be aware, the code is messy in it's current state.</p><p></p><p>Thanks. <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /></p></blockquote><p></p>
[QUOTE="NSA, post: 325985, member: 10034"] Hi all! I'm trying to get a div to move from the left hand side of the screen to the right, back to the left and repeat. Now, this would be easy to do using jQuery's animate function, however... I want to be able to clone the current moving element, have it stop in its current position and the newly cloned element to carry on from where the old element was. Now, again this is fine with animate, however, with the functions set time to finish animation, once I call animate on the new element, even if it's like... 2px from the right hand side of the screen, it still takes the full length to finish. So, I tried doing it with a loop and it "kind of works". The element moves from the left, to the right and glitches out when it tries to go back to the right hand side. If anybody could take a look and see what the problem is, I'd appreciate it because I'm stuck. You can see my current code here: [URL]http://welfordian.com/game/[/URL] but please be aware, the code is messy in it's current state. Thanks. :-) [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
Javascript - Flow side to side.
Top