Cita:
Iniciado por satanson123
Usa el mismo ejemplo que te comente mas arriba:
Código HTML:
Ver original<!DOCTYPE html>
<!--
Created using JS Bin
http://jsbin.com
Copyright (c) 2014 by anonymous (http://jsbin.com/mukaxowufu/1/edit)
Released under the MIT license: http://jsbin.mit-license.org
-->
<meta name="robots" content="noindex"> #bar{
display: block;
}
.foo{
max-width: 400px;
}
<img src = "http://www.absolut-canada.com/wp-content/uploads/2009/09/pesca-en-quebec.jpg" class = "foo" /> <img src = "http://static3.absolutcaribe.com/wp-content/uploads/2009/09/playa-placencia.jpg" class = "foo" /> <script id="jsbin-javascript"> var boton = document.querySelector("#bar"),
imagenes = document.querySelectorAll(".foo"),
total = imagenes.length;
boton.addEventListener("click", function(){
for (var i = 0; i < total; i++){
if (getComputedStyle(imagenes[i]).maxWidth == "400px"){
imagenes[i].style.maxWidth = "120px";
}
else{
imagenes[i].style.maxWidth = "400px";
}
}
}, false);
Solo tenias que borrar una imagen.
Este ejemplo sí funciona. Tengo que estudiarlo a ver si lo entiendo.
Funciona perfecto.
Muchísimas gracias.
Un saludo.