Start queued effects in global queue : Effect « Scriptaculous « JavaScript DHTML






Start queued effects in global queue

 
<!--
Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->

<!-- revised from scriptaculous-js-1.8.2 demo code  -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>script.aculo.us Effects functional test file</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <script src="scriptaculous-js-1.8.2/lib/prototype.js" type="text/javascript"></script>
  <script src="scriptaculous-js-1.8.2/src/scriptaculous.js" type="text/javascript"></script>
  <script src="scriptaculous-js-1.8.2/src/unittest.js" type="text/javascript"></script>
  <style type="text/css" media="screen">
  
    #d1 { background-color: #fcb; width: 200px; height: 200px; float:left; }
    #d2 { background-color: #cfb; font-size: 2em; width: 200px; height: 200px; float:left; }
    #d3 { background-color: #bcf; font-size: 2em; width: 200px; height: 200px; float:left; }
  
  </style>
  
</head>
<body>
<h1>script.aculo.us Effects functional test file</h1>

<h2>Effect.Queue</h2>

<div id="d1" style="font-size: 2em;">
  <p style="font-size:1em;">Lorem ipsum dolor sit amet</p>
</div>

<div id="d2">
  <p>Lorem ipsum dolor sit amet</p>
</div>

<div id="d3">
  <p>Lorem ipsum dolor sit amet</p>
</div>

<div style="clear: both">
  <a href="#" onclick="startTimeline(); return false;">Start queued effects</a> (in 'global' queue)
</div>

<div id="sliding"><div style="background-color:#ccc;font-size:20px;height:300px;width:150px;">
  <a href="#" onclick="Effect.SlideUp('sliding',{queue:{scope:'myscope', position:'end'}}); Effect.SlideDown('sliding',{queue:{scope:'myscope', position:'end'}}); return false;">
    Do a bit sliding in parallel, with a scoped queue
  </a>
</div></div>

<script type="text/javascript" language="javascript" charset="utf-8">

  function startTimeline() {
    // 3x highlight in front
    for(var i=0; i<3; i++)
      new Effect.Highlight('d3', { duration: 1.0, queue: 'front' });
    
    // insert scale at very beginning
    new Effect.Scale('d1', 75, { scaleContent: true, duration: 1.0, queue: 'front' });
    
    // parallel implied, delay 0.5 sec
    new Effect.Highlight('d1', { delay: 0.5 }); 
    
    // puff at end
    new Effect.Puff('d2', { duration: 4.0, queue: 'end' });
  }

</script>


</body>
</html>

   
  








Related examples in the same category

1.Effect.Queue limit
2.Random effects demo
3.Synchronized parallel execution of effects