i have created sliding image gallery , when button pushed slides picture across , updates image attribute relevant sections. works 50% of time. other times there second glitch , images go in place expected. have attached javascript methods animate method , array change method. have looked elsewhere , cannot see else similar issue or going wrong, when doesn't happen often. imagegallery.leftselect.onclick = function () { window.settimeout(imagegallery.rightclick, 250); imagegallery.animateimages('.image1', '.imageright'); imagegallery.animateimages('.imageright', '.imagenoneright'); imagegallery.animateimages('.imageleft', '.image1'); imagegallery.animateimages('.imagenoneleft', '.imageleft'); }; animateimages: function (classfrom, classto) { var classmoving = $(classfrom); var classgoingto = $(classto); classmoving.animate({ top: classgoingto.css('top'), ...