Skip to content

Instantly share code, notes, and snippets.

@UlisesGascon
Created March 31, 2016 16:25
Show Gist options
  • Save UlisesGascon/57ed4ed61fbc987b0e3265568a27f6c4 to your computer and use it in GitHub Desktop.
Save UlisesGascon/57ed4ed61fbc987b0e3265568a27f6c4 to your computer and use it in GitHub Desktop.
Cambiar las fotos de Genbeta por fotos de gatitos
var imagenes = document.querySelectorAll('.article-home-figure img');
var imagenesLog = [];
for(var i = 0; i < imagenes.length; i++){
var url = document.querySelectorAll('.article-home-figure img')[i].src;
var ancho = document.querySelectorAll('.article-home-figure img')[i].width;
var alto = document.querySelectorAll('.article-home-figure img')[i].height;
var sustituto = "http://lorempixel.com/"+ancho+"/"+alto+"/cats";
var datos = [url, ancho, alto, sustituto]
imagenesLog.push(datos);
document.querySelectorAll('.article-home-figure img')[i].src = sustituto;
document.querySelectorAll('.article-home-figure img')[i].srcset = sustituto +" "+ancho+"w", sustituto +" "+ancho+"w";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment