mercredi 28 juin 2017

no randomly arranged images after reload

I arranged some pictures randomly above another image. When they were dropped, I print an alert and then I want to reload the page to start again. But in this case, the images are laying in one corner, overlapping completely. I tried to wait after my random-method. But nothing worked.

   $( 'img.box' ).each(function( index ) {
          $(this).css({
            left: Math.random() * ($('img.bod').width() - $(this).width()),
            top: Math.random() * ($('img.bod').height() - $(this).height())
          });
        });

and some lines to restart my page:

         window.confirm("Great you finished");
         window.location.reload(); 




Aucun commentaire:

Enregistrer un commentaire