Javascript Mouse-Over Event w/ Animated GIF

Discussion in 'General Hardware' started by koko, Nov 15, 2003.

  1. koko

    koko Got Root?

    Messages:
    577
    Location:
    Columbia, S.C.
    wondering if anyone can point me in the right direction...

    i've made an animated GIF in photoshop imageready for use as a sig pic on another forum. it's about 90 frames.

    what i'd like to do is this: anytime someone mouses over the image, the animation should start and play once, then return to a static image.

    is there a really easy way to do what i want, or am i in for some serious coding? :confused:
     
  2. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    You can set the GIF to loop only once upon loading, but you can not look for someone to "mouse over" the image, and then get it to play.

    And you can not do it with any serious coding either.
     
  3. koko

    koko Got Root?

    Messages:
    577
    Location:
    Columbia, S.C.
    but i've seen another sig pic that does exactly this.

    i've seen some simple "mouse-over" javascripts, so i'm pretty sure it can be done with either javascript or photoshop rollovers.

    anyone?
     
  4. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    If you're allowed HTML in your sig on the forum then it's very possible. You need to take the first frame and export it as a static image. Then on the mouse over actually change the image to the gif, which will then play.
    But not many forums allow HTML in signatures, because to be honest, it's stupid.
     
  5. koko

    koko Got Root?

    Messages:
    577
    Location:
    Columbia, S.C.
    yep, this other forum allows html. thanks for the ideas about how to proceed speedy!

    /runs off to try and make it work ;)
     
  6. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    you can also do it with flash as well if they allow that
     
  7. koko

    koko Got Root?

    Messages:
    577
    Location:
    Columbia, S.C.
    yes, flash is allowed on that site, but sadly, i know absolutely nothing about it. i've heard the learning curve for it is steep and right now, i just don't have the time.
     
  8. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
  9. koko

    koko Got Root?

    Messages:
    577
    Location:
    Columbia, S.C.
    found a simple solution using javascript. here it is in case anyone is interested...

    stick this between the <head> tags:

    *************************************************

    <script language = JAVASCRIPT>
    <!-- Hide script from old browsers
    if (document.images)
    {
    redChile = new Image
    danceChile = new Image

    redChile.src = "name of static image goes here"
    danceChile.src = "name of animated gif goes here"
    }
    // Stop hiding script from older browsers -->
    </SCRIPT>

    *************************************************

    stick this between the <body> tags:

    *************************************************
    <A HREF="/news/vol3/design_no10.htm" onMouseover = "document.Chile.src=danceChile.src" onMouseout = "document.Chile.src=redChile.src">
    <IMG BORDER="0" SRC="name of static image goes here" ALT="hold mouse on pic for animation" NAME="Chile" WIDTH="380" HEIGHT="154"></A>

    *************************************************

    enjoy! :D
     
  10. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    How are you going to put a script between the <head> tags of a forum?
     
  11. koko

    koko Got Root?

    Messages:
    577
    Location:
    Columbia, S.C.
    i'm working on that. ;)
     
  12. j79zlr

    j79zlr Glaanies script monkey Political User

    Messages:
    2,725
    Location:
    Chicago
    you dont need the script in the head section, it can be placed anywhere.
     
  13. koko

    koko Got Root?

    Messages:
    577
    Location:
    Columbia, S.C.
    it didn't function at all when i inserted it into the signature field in my profile on the other bbs.

    i guess it wigged out when it saw the javascript. ;)

    back to the drawing board...
     
  14. j79zlr

    j79zlr Glaanies script monkey Political User

    Messages:
    2,725
    Location:
    Chicago
    well the board might have script tags disabled for the signature. I still dont see the need
     
  15. koko

    koko Got Root?

    Messages:
    577
    Location:
    Columbia, S.C.
    you're probably right. maybe i should start learning flash. :confused:
     
  16. chaos945

    chaos945 Moderator

    Messages:
    934
    **Shivers**
     
  17. koko

    koko Got Root?

    Messages:
    577
    Location:
    Columbia, S.C.
    yep, that bbs doesn't allow javascript in messages or in the signature field.

    BUT! someone suggested i try out swish. apparently, it's an app that can make little movies like i want fairly easily and it's not as hard to learn as flash!

    so, phooey on flash.....i'm gonna d/l the swish demo. :)

    get it here

    also, i found tons of swish tutorials via google, so i may start soon.
     
  18. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    Yup, swish is stupidly easy to use. Point'n'Click flash :D
     
  19. koko

    koko Got Root?

    Messages:
    577
    Location:
    Columbia, S.C.
    cool! :)