Created
May 9, 2013 22:25
-
-
Save cron64/5551081 to your computer and use it in GitHub Desktop.
JS: Cambiar Imagen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//DETECTAR ANCHO | |
var ancho; | |
if (document.body) | |
ancho = (document.body.clientWidth); | |
else | |
ancho = (window.innerWidth); | |
if (ancho<=770) | |
{ | |
//Código de ejemplo... | |
$("#contenido img").attr("src",rutaImagen768); | |
} | |
// | |
$(window).resize(function () { | |
if($(window).width() <= 770){ | |
$("#contenido img").attr("src",rutaImagen768); | |
}else{ | |
$("#contenido img").attr("src",rutaImagen1024); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment