DHTML
  Home arrow DHTML arrow Page 3 - Using Combination Effects with the Scripta...
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  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
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? 
DHTML

Using Combination Effects with the Scriptaculous DHTML Library
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2007-04-18

    Table of Contents:
  • Using Combination Effects with the Scriptaculous DHTML Library
  • Applying more combination effects
  • Going one step further into DHML animations
  • Examining some additional DHTML effects

  • 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


    Using Combination Effects with the Scriptaculous DHTML Library - Going one step further into DHML animations


    (Page 3 of 4 )

    Now I'm going to show you more eye-catching animations that come integrated with the Scriptaculous framework so you can grasp quickly how to use them with your own web applications.

    Take a look at the following examples, which illustrate the correct implementation of three new combination effects, named “SwitchOff,” “SlideUp” and “SlideDown” respectively. Here they are:

    (Implementation of SwitchOff effect)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
     
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
     
    <title>Example of SwitchOff effect (combination of effects)</title>
     
    <script language="javascript"
    src="scriptaculous/js/prototype.js"></script>
     
    <script language="javascript"
    src="scriptaculous/js/scriptaculous.js"></script>
     
    <script language="javascript">
       
    // display effect
       
    function displayEffect(){
           new Effect.SwitchOff('container');
       
    }
       
    function initializeElement(){
           Event.observe($('container'),'click',displayEffect,false);
       
    }
       
    Event.observe(window,'load',initializeElement,false);
      
    </script>
     
    <style type="text/css">
       
    #container{
          position: absolute;
          top: 200px;
          left: 200px;
          width: 300px;
          height: 100px;
          padding: 10px;
          background: #cf9;
          font: normal 11px Verdana, Arial, Helvetica, sans-serif;
          color: #000;
          text-align: center;
          border: 1px solid #999;
        }
     
    </style>
    </head>
    <body>
     
    <div id="container">This element will disappear now</div>
    </body>
    </html>

    (Implementation of SlideUp effect)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
     
    <title>Example of SlideUp effect (combination of effects)</title>
     
    <script language="javascript"
    src="scriptaculous/js/prototype.js"></script>
     
    <script language="javascript"
    src="scriptaculous/js/scriptaculous.js"></script>
     
    <script language="javascript">
       
    // display effect
       
    function displayEffect(){
           new Effect.SlideUp('container');
       
    }
       
    function initializeElement(){
           Event.observe($('container'),'click',displayEffect,false);
       
    }
       
    Event.observe(window,'load',initializeElement,false);
     
    </script>
     
    <style type="text/css">
       
    #container{
          position: absolute;
          top: 200px;
          left: 200px;
          width: 300px;
          height: 100px;
          padding: 10px;
          background: #cf9;
          font: normal 11px Verdana, Arial, Helvetica, sans-serif;
          color: #000;
          text-align: center;
          border: 1px solid #999;
       
    }
     
    </style>
    </head>
    <body>
     
    <div id="container">This element is sliding up now</div>
    </body>
    </html>

    (Implementation of SlideDown effect)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
     
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
     
    <title>Example of SlideDown effect (combination of effects)</title>
     
    <script language="javascript"
    src="scriptaculous/js/prototype.js"></script>
     
    <script language="javascript"
    src="scriptaculous/js/scriptaculous.js"></script>
     
    <script language="javascript">
       
    // display effect
       
    function displayEffect(){
           Effect.SlideDown('container', {duration:3});
       
    }
       
    function initializeElement(){
           Event.observe($('container'),'click',displayEffect,false);
       
    }
       
    Event.observe(window,'load',initializeElement,false);
     
    </script>
     
    <style type="text/css">
       
    #container{
          position: absolute;
          top: 200px;
          left: 200px;
          width: 300px;
          height: 100px;
          padding: 10px;
          background: #cf9;
          font: normal 11px Verdana, Arial, Helvetica, sans-serif;
          color: #000;
          text-align: center;
          border: 1px solid #999;
        
    }
     
    </style>
    </head>
    <body>
     
    <div id="container">This element is sliding down now</div>
    </body>
    </html>

    As illustrated above, these three brand new DHTML animations can be useful in those cases where you need to make some web page elements disappear in a funny way. In all three hands-on examples, a sample DIV element will be removed from the corresponding web document, displaying different visual effects.

    As I said before, try running all the examples on your own browser, so you can get a better idea of how they work.

    So far, so good. At this point I assume that you already understand the logic that drives each one of the DHTML effects that were shown previously, which are, by the way, quite easy to include into any web page.

    However, this educational journey hasn’t finished yet, because the Scriptaculous library has been provided with some additional predefined animations that I’d like to show you. Therefore, keeping this in mind, in the section to come – the last one of this tutorial – I’m going to cover in detail the aforementioned animations, in this way completing this brief review of the robust Scriptaculous’ DHTML module.

    To learn how these brand new visual effects will be coded, go ahead and read the last section of this article. 

    More DHTML Articles
    More By Alejandro Gervasio


       · In this third (and last) article of the series, you’ll learn how to use some the...
       · Umm, all you did was provide code that's all ready available. You didn't "combine"...
       · Thank you for commenting on my DHTML article. Actually, the code samples shown here...
       · Thank you ,, for me as a beginner , it is great
       · Glad to know my article has been helpful to you.Regards.
     

    DHTML ARTICLES

    - Text-Justify, Volume, and Other Style Sheet ...
    - Ruby-Position, Size, and Other Style Sheet P...
    - Padding, Pages, and More Style Sheet Propert...
    - Marks, Orphans, and More Style Sheet Propert...
    - Layouts, Margins, and Other Style Sheet Prop...
    - Floats, Fonts, and Other Style Sheet Propert...
    - Color, Filters, and Other Style Sheet Proper...
    - Borders and More with Style Sheets
    - Learning Style Sheet Properties
    - Style Sheet Property Reference
    - Completing a Noisy Image Application
    - An Object-Based Approach to Building Noisy I...
    - A Basic Method for Building Noisy Images
    - Adding More Features to Sliders with the Scr...
    - Using Sliders with the Scriptaculous Framewo...






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT