jeudi 7 avril 2016

random slideshow with two images with transitions

I am busy with a javascript for a two images 'slideshow' with random appearance of images at random intervals. so far it works. But now I want to ad transitions at the appearance and the disappearance of the images. And I am wondering if it is possible to show randomly only one picture.

I have this code so far:

var j;
var rand = 700;
function randomize() {
    loadRandom();
    updateImages();
    rand = Math.round(Math.random()*(5000-700+1))+700; 
    clearInterval(j);
    j = setInterval('randomize();', rand);
}
j = setInterval('randomize();', rand);



function loadRandom(){
    var ranNums=[];
    while(ranNums.length<6){
        var t=Math.floor((Math.random()*7)+1);
        if(ranNums.indexOf(t)==-1)
            ranNums.push(t);
    }
    var i=0;
    $('#imageTable > .image-container > img').each(function(){
        $(this).attr('src','images/image-'+ranNums[i]+'.jpg');
        i++;
    });
}

I hope someone can help me Cheers




Aucun commentaire:

Enregistrer un commentaire