Skip to content

Instantly share code, notes, and snippets.

@ymoussaba
Forked from rumblestrut/rotate.js
Created September 2, 2019 15:48
Show Gist options
  • Select an option

  • Save ymoussaba/ad087b13b05ef96623dd63a8441e8093 to your computer and use it in GitHub Desktop.

Select an option

Save ymoussaba/ad087b13b05ef96623dd63a8441e8093 to your computer and use it in GitHub Desktop.

Revisions

  1. @rumblestrut rumblestrut created this gist May 4, 2011.
    59 changes: 59 additions & 0 deletions rotate.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    Oh sure, you could do this with jQuery, but in my early days, this is what I used ...

    <script>
    <!--
    // Set slideShowSpeed (milliseconds)
    var slideShowSpeed = 8000

    // Duration of crossfade (seconds)
    var crossFadeDuration = 3

    // Specify the image files
    var Pic = new Array() // don't touch this
    // to add more images, just continue
    // the pattern, adding to the array below

    Pic[0] = '0.jpg';
    Pic[1] = '1.jpg';
    Pic[2] = '2.jpg';


    // =======================================
    // do not edit anything below this line
    // =======================================

    var Dummyt
    var nCounterj = 0
    var PicLen = Pic.length

    var preLoad = new Array()
    for (nCounteri = 0; nCounteri < PicLen; nCounteri++){
    preLoad[nCounteri] = new Image()
    preLoad[nCounteri].src = Pic[nCounteri]
    }

    function runSlideShow(){
    if (document.all){
    document.images.SlideShow.style.filter='blendTrans(duration=2)'
    document.images.SlideShow.style.filter='blendTrans(duration=crossFadeDuration)'
    document.images.SlideShow.filters.blendTrans.Apply()
    }
    document.images.SlideShow.src = preLoad[nCounterj].src
    if (document.all){
    document.images.SlideShow.filters.blendTrans.Play()
    }
    nCounterj = nCounterj + 1
    if (nCounterj > (PicLen-1)) nCounterj=0
    Dummyt = setTimeout('runSlideShow()', slideShowSpeed)
    }
    </script>

    -->

    ...

    <img src="" name='SlideShow' alt="SlideShow">
    <script>
    runSlideShow();
    </script>
    </a>