Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(window).load(function(){
- var images = ['blaa.jpg','sdsd.jpg'];
- var i = 0;
- var timeoutVar;
- function changeBackground() {
- clearTimeout(timeoutVar); // just to be sure it will run only once at a time
- jQuery('#absolute-c').css('background-image', function() {
- if (i >= images.length) {
- i=0;
- }
- return 'url(' + images[i++] + ')';
- });
- // call the setTimeout every time to repeat the function
- timeoutVar = setTimeout(changeBackground, 3000);
- }
- // Call it on the first time and it will repeat
- changeBackground();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement