SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: fading images

  1. #1
    SitePoint Evangelist
    Join Date
    May 2007
    Location
    Kent in Uk
    Posts
    538
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    fading images

    hi, very new to javascript. i have recently managed to use it to change an image like this:

    </script>
    <script language="javascript">
    img1 = new Image();
    img1.src = "frimage/Lynflip1.jpg";
    img2 = new Image()
    img2.src = "frimage/Lynflip2.jpg";
    function domSwap() {
    theImg=document.getElementById("myimage");
    theImg.setAttribute("src", "frimage/Lynflip2.jpg");
    }
    function domSwapBack() {
    theImg=document.getElementById("myimage");
    theImg.setAttribute("src", "frimage/Lynflip1.jpg");
    }
    </script>

    however what I would like to do is change the im images so they fade into each other. anyone know if I can do that using the above script or is it a whole different ball game?

  2. #2
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Take a look at: http://www.brainerror.net/scripts/ja...pt/blendtrans/

    Also, I wouldn't use setAttribute to set the src, simply access the property, ie

    Code:
    theImg.src = 'frimage/Lynflip1.jpg';



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
  •