SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast Jack Michaelson's Avatar
    Join Date
    May 2002
    Location
    Netherlands
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JS and animated gifs

    Hi,

    Does anyone know if it's possible to control an animated gif using JS? Let's say to control the number of frames to be played or to control which frame has to be displayed?
    Or to start/stop the animation?

    I don't think it is, but hey, you'll never know

    thanx,
    Jack

  2. #2
    SitePoint Addict
    Join Date
    Mar 2002
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: JS and animated gifs

    Sorry but it isn't possible. The animated GIF's timing can only be adjusted at the time it is created. But there is no reason why you shouldn't use JS to animate your own set of images altough they will have to be stored seperately on the server rather than in a single file. Hope this helps.

    Nick
    All4YourPC for all your PC needs. Custom software.
    Websites. Web marketing. Training.
    http://members.aol.com/nickjc67

  3. #3
    SitePoint Enthusiast Jack Michaelson's Avatar
    Join Date
    May 2002
    Location
    Netherlands
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanx anyway
    Jack

  4. #4
    SitePoint Addict AHMED's Avatar
    Join Date
    Oct 2002
    Location
    Egypt
    Posts
    399
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    u can do it

    it 's possible 2 control some images in a slideshow lige animates gif
    Code:
    <html>
    <script>
    
    /************/
    /* Settings */
    /************/
    
    // Where are the images?
    clips = new Array("images/yourbloodinmymouth.jpg",
    "1.jpg",
    "2.jpg",
    "3.gif",
    "4.gif");
    
    // Where do u want them to be linked to?
    linksS = new Array("http://www.c4arab.com",
    "http://www.cnn.com",
    "http://www.c4arab.com",
    "http://mrcomputer-uae.virtualave.net/",
    "http://www.c4arab.com")
    
    // How many seconds u want the banner to be on?
    num = 10
    
    /*********************************/
    /* don't change anthing below    */
    /*********************************/
    
    count = 0;
    max=clips.length;
    
    function val(){
        if(document.images){
            count++;
            if(count == max) {
                count=0;
            }
            document.star.src= clips[count];
            setTimeout("val()", num * 1000);
        }
    }
    
    function goNow(){
         window.location=linksS[count];
    }
    
    </script>
    
    <!-- The Page it Self -->
    <html>
    <body onLoad=val() bgcolor="#FFFFE6">
    <center>
    <a href=javascript:goNow()>
    <img src="images/yourbloodinmymouth.jpg" name=star border=0></a>
    </body>
    </html>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •