JQuery Slide element and clone to create 'infinite' loop -


i having issue feel on complicating. have container div houses inner div. inner div has background image slides left. once div reaches point want clone give seamless appearance of infinite loop.

jsfiddle: http://jsfiddle.net/9phzt/

here non-working code have @ point:

function moveplatform() {    $("div."+theplatform).animate({"left": "-3000px"},5000,"linear", function() {     $(this).remove(); }); } function cloneplatform() {     var clonepoint = 3000 - thewidth;     var theright = getposition(theplatform);     if (clonepoint < theright) {         $("div."+theplatform).clone().appendto("div#container");     } } function getposition(el) {     var theleft = $("div."+el).offset().left     var theright = $("div."+el).offset().left + $("div."+el).width();     //return theleft     return theright } 

an issue functionality create endless clones based on if statement parameters. looking clone platform once when reaches right edge of viewpoint.

any appreciated. thanks!


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -