DHTML
  Home arrow DHTML arrow Page 2 - 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  
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? 
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 - Applying more combination effects


    (Page 2 of 4 )

    As I clearly stated in the introduction of this article, the Scriptaculous DHTML module comes packaged with a decent number of predefined effects. Some of them were properly reviewed in the preceding article of the series. Nevertheless, there are many that still remain uncovered, so let me offer you a quick explanation of how they work.

    I’m going to start this brief review by taking a look at the first group of combination effects, which are called “Shake,” “BlindDown” and “BlindUp” respectively.

    With reference to using these brand new effects, a simple implementation for each one of them is shown below. I suggest you to examine the corresponding code samples. Here they are:

    (Implementation of Shake 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 Shake 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.Shake('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 shaking now</div>
    </body>
    </html>

    (Implementation of BlindDown 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 BlindDown 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.BlindDown('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 blind down now</div>
    </body>
    </html>

    (Implementation of BlindUp 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 BlindUp 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.BlindUp('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 blind up now</div>
    </body>
    </html>

    As you can see, the three combination effects shown above are indeed easy to follow, since all of them can be implemented by a similar approach. In the first example, a simple DIV element is animated by utilizing the “Effect.Shake” animation, while the second and third cases demonstrate the use of the neat “Effect.BlindUp” and “Effect.BlindDown” effects respectively.

    Of course, if you want to see more clearly what these animations look like, simply copy and paste the source code that corresponds to all previous hands-on examples into your favorite text editor and watch them on your own browser. Indeed, this is the best way to appreciate the real potential of a particular animation.

    All right, now that you have learned how to use the “Shake,” “BlindUp” and “BlindDown” combination effects that come bundled with Scriptaculous, it’s time to leap forward and continue exploring more DHTML animations.

    With reference to this specific topic, in the next section I’ll be talking a close look at some new combination effects, called “SwitchOff, “SlideUp” and “SlideDown,” so if you want to learn how they work, please click on the link below and keep reading.

    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-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek