Skip to content

Instantly share code, notes, and snippets.

@BenjaminGuV
Created March 22, 2012 12:17
Show Gist options
  • Save BenjaminGuV/2157988 to your computer and use it in GitHub Desktop.
Save BenjaminGuV/2157988 to your computer and use it in GitHub Desktop.
cambiar la imagen de background con jquery
(function(){
var i = 2;
var cambiar = setInterval( function(){
//$('#cambiante').css( 'background-image', 'url("2.jpg")' );
$('#cambiante').animate({
opacity: 0
}, 'slow', function(){
$(this).css( {'background-image': 'url("' + i + '.jpg")'} )
.animate({opacity: 1});
i++;
if ( i == 3 ) { i = 1 };
});
}, 2000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment