2014-06-13 7 views
0

J'ai un code d'image aléatoire mais le temps intrvel ne fonctionne pas sur le codePourquoi le temps ne fonctionne pas dans le code?

<script type="text/javascript"> 
    //extending jQuery with ':random' selector, best put into separate plugin js file 
    jQuery.jQueryRandom = 0; 
    jQuery.extend(jQuery.expr[":"], 
    { 
     random: function(a, i, m, r) { 
      if (i == 0) { 
       jQuery.jQueryRandom = Math.floor(Math.random() * r.length); 
      }; 
      return i == jQuery.jQueryRandom; 
     } 
    });   
    //end :random extend 
$ (Function() { 
    var next = function() 
    { 

    . $ ('# Slideshow img') not (': random') hide(). 
    setInterval (function() { 
     $ ('# Slideshow img: visible') fadeOut ('slow'). 
     . Siblings ('img: random'). FadeIn ('slow') 

    }, 10000); 
    } 
    next(); 
    }); 
</script> 

Ce "10000" n'est pas working.Please me aider

+0

Est-ce une erreur d'édition ou votre erreur de codage? –

+0

désolé. Je ne sais pas . Je suis nouveau dans jqaury, ce code obtenu à partir d'un site –

+1

'google' ne peux pas faire cela –

Répondre

1

Essayez ceci,

setInterval(function(){ 
randNum = getRandomInt(0, imgArray.length - 1); 
nextBG = "url(" + imgArray[randNum] + ") no-repeat bottom center"; 
$('#slideshow img:first').attr("src", imgArray[randNum]); 

}, 10000);

+0

Merci beaucoup –

Questions connexes