vendredi 20 février 2015

Each image less than the previous

I have array with 5 images, wich i displayed by php. How to make with JavaScript that each image have been 10% lower than the previous.



foreach($top_images as $top_i) {
echo '#'.$ratio;
echo '
<br><img src="'.$top_i['url'].'" ><br>
<script type="text/javascript">
$(document).ready(function(){
var img = new Image();
img.src = "'.$top_i['url'].'";
img.onload = function() {
var width = this.width;
var height = this.height;
ratio = '.json_encode($ratio).';
this.width = this.width - this.width * ratio/10;
this.height = this.height - this.height * ratio/10;
}
});
</script>
';
$ratio++;
}


p.s. Im beginner, thats why my code is so shitty


Aucun commentaire:

Enregistrer un commentaire