У меня есть массив с 5 изображениями, которые я отобразил php. Как сделать с JavaScript, что каждое изображение на 10% меньше предыдущего.Каждое изображение меньше предыдущего
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++;
}