Created
March 22, 2012 12:17
-
-
Save BenjaminGuV/2157988 to your computer and use it in GitHub Desktop.
cambiar la imagen de background con jquery
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
(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