HTML
  Home arrow HTML arrow Page 2 - Changing and Moving Pictures with CSS
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Changing and Moving Pictures with CSS
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 11
    2008-06-09

    Table of Contents:
  • Changing and Moving Pictures with CSS
  • Moving Pictures Demonstration
  • CSS Properties to Use
  • Algorithm

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Changing and Moving Pictures with CSS - Moving Pictures Demonstration


    (Page 2 of 4 )

    In this example a ball keeps moving through an arc. Copy the following code in to a text editor and save the result as an HTML file in a directory. The pictures for this demonstration are attached: they are called, ball1.gif, ball2.gif, ball3.gif, ball4.gif, ball5.gif, ball6.gif, ball7.gif, ball8.gif, ball9.gif. You can find the images in the last section of this article.

    The images are in order and each one shows the ball in a slightly different position from the previous one. Download and save the pictures in the same directory as the file above. Open the file with a browser and you should see the ball moving through an arc repeatedly.



    <html>


    <head>

    <style type="text/css">

    body {position:relative; z-index:0; background-color:maroon; color:white}

    td#Pics {width:302px; height:233px; vertical-align:top}

     

    img#ball1 {position:absolute; border:0px; z-index:2}

    img#ball2 {position:absolute; border:0px; z-index:1}

    img#ball3 {position:absolute; border:0px; z-index:1}

    img#ball4 {position:absolute; border:0px; z-index:1}

    img#ball5 {position:absolute; border:0px; z-index:1}

    img#ball6 {position:absolute; border:0px; z-index:1}

    img#ball7 {position:absolute; border:0px; z-index:1}

    img#ball8 {position:absolute; border:0px; z-index:1}

    img#ball9 {position:absolute; border:0px; z-index:1}

     

    </style>

    <script type="text/javascript">

    var A=2;

    var B=1;

    var C=1;

    var D=1;

    var E=1;

    var F=1;

    var G=1;

    var H=1;

    var I=1;

    var Temp;


    function beChanging()

    {

    Temp=I; I=H; H=G; G=F; F=E; E=D; D=C; C=B; B=A; A=Temp;

     

    document.getElementById('ball1').style.zIndex = A;

    document.getElementById('ball2').style.zIndex = B;

    document.getElementById('ball3').style.zIndex = C;

    document.getElementById('ball4').style.zIndex = D;

    document.getElementById('ball5').style.zIndex = E;

    document.getElementById('ball6').style.zIndex = F;

    document.getElementById('ball7').style.zIndex = G;

    document.getElementById('ball8').style.zIndex = H;

    document.getElementById('ball9').style.zIndex = I;

     

    setTimeout("beChanging()",100);

    }


    </script>


    </head>


    <body onload="beChanging()">


    <table cellpading="0" cellspacing="0" border="0">

    <tbody>

    <tr>

    <td width="100">Some content can go in the first cell.

    </td>

    <td id="Pics">

    <img src="ball1.gif" usemap ="#MP" id="ball1">

    <img src="ball2.gif" usemap ="#MS" id="ball2">

    <img src="ball3.gif" usemap ="#MF" id="ball3">

    <img src="ball4.gif" usemap ="#MM" id="ball4">

    <img src="ball5.gif" usemap ="#MP" id="ball5">

    <img src="ball6.gif" usemap ="#MS" id="ball6">

    <img src="ball7.gif" usemap ="#MF" id="ball7">

    <img src="ball8.gif" usemap ="#MM" id="ball8">

    <img src="ball9.gif" usemap ="#MM" id="ball9">

    </td>

    <td>&nbsp;Some content can go in the third cell.

    </td>

    </tr>

    </tbody>

    </table>

    <p>Some content can go below the table. </p>

    </body>


    </html>


    More HTML Articles
    More By Chrysanthus Forcha


       · If you thought that you cannot make images move, you thought wrong. This article...
     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT