JavaScript DHTML/YUI Library/Fade

Материал из Web эксперт
Версия от 10:28, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

ContainerEffect Transitions: fade in and fade out

   <source lang="html4strict">


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head>

   <meta http-equiv="content-type" content="text/html; charset=utf-8">

<title>Using ContainerEffect Transitions</title> <style type="text/css"> /*margin and padding on body element

 can introduce errors in determining
 element position and are not recommended;
 we turn them off as a foundation for YUI
 CSS treatments. */

body {

 margin:0;
 padding:0;

} </style> <link rel="stylesheet" type="text/css" href="yui_2.7.0b-lib/fonts/fonts-min.css" /> <link rel="stylesheet" type="text/css" href="yui_2.7.0b-lib/container/assets/skins/sam/container.css" /> <script type="text/javascript" src="yui_2.7.0b-lib/yahoo-dom-event/yahoo-dom-event.js"></script> <script type="text/javascript" src="yui_2.7.0b-lib/animation/animation-min.js"></script> <script type="text/javascript" src="yui_2.7.0b-lib/container/container-min.js"></script>

</head> <body class=" yui-skin-sam">

Using ContainerEffect Transitions

The <a href="http://developer.yahoo.ru/yui/container/">Container Family</a> of controls, including <a href="http://developer.yahoo.ru/yui/container/overlay/">Overlay</a> and all of its subclasses (<a href="http://developer.yahoo.ru/yui/container/panel/">Panel</a>, <a href="http://developer.yahoo.ru/yui/container/tooltip/">Tooltip</a>, <a href="http://developer.yahoo.ru/yui/container/dialog/">Dialog</a>, <a href="http://developer.yahoo.ru/yui/container/simpledialog/">SimpleDialog</a>), can implement built-in transition effects using the effect property and the <a href="http://developer.yahoo.ru/yui/docs/YAHOO.widget.ContainerEffect.html">ContainerEffect</a> object. This example demonstrates the fade and slide transitions provided with Container.

Use the buttons below to show and hide Overlays, noting their transition treatments as they appear and disappear.

<style> .yui-overlay { position:absolute;border:1px dotted black;padding:5px;margin:10px;background:#fff; } .yui-overlay .hd { border:1px solid red;padding:5px; } .yui-overlay .bd { border:1px solid green;padding:5px; } .yui-overlay .ft { border:1px solid blue;padding:5px; } </style> <script> YAHOO.namespace("example.container"); function init() {

 // Build overlay1 based on markup
 YAHOO.example.container.overlay1 = new YAHOO.widget.Overlay("overlay1", { xy:[350,100],
                                       visible:false,
                                       width:"300px",
                                       zIndex:1000,
                                       effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );
 YAHOO.example.container.overlay1.render("example");
 // Build overlay2 based on markup
 YAHOO.example.container.overlay2 = new YAHOO.widget.Overlay("overlay2", { xy:[350,100],
                                       visible:false,
                                       width:"300px",
                                       zIndex:1000,
                                       effect:{effect:YAHOO.widget.ContainerEffect.SLIDE,duration:0.25} } );
 YAHOO.example.container.overlay2.render("example");
 // Build overlay3 based on markup
 YAHOO.example.container.overlay3 = new YAHOO.widget.Overlay("overlay3", { xy:[350,100],
                                       visible:false,
                                       width:"300px",
                                       zIndex:1000,
                                       effect:[{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5},
                                           {effect:YAHOO.widget.ContainerEffect.SLIDE,duration:0.5}] } );
 YAHOO.example.container.overlay3.render("example");
 YAHOO.util.Event.addListener("show1", "click", YAHOO.example.container.overlay1.show, YAHOO.example.container.overlay1, true);
 YAHOO.util.Event.addListener("hide1", "click", YAHOO.example.container.overlay1.hide, YAHOO.example.container.overlay1, true);
 YAHOO.util.Event.addListener("show2", "click", YAHOO.example.container.overlay2.show, YAHOO.example.container.overlay2, true);
 YAHOO.util.Event.addListener("hide2", "click", YAHOO.example.container.overlay2.hide, YAHOO.example.container.overlay2, true);
 YAHOO.util.Event.addListener("show3", "click", YAHOO.example.container.overlay3.show, YAHOO.example.container.overlay3, true);
 YAHOO.util.Event.addListener("hide3", "click", YAHOO.example.container.overlay3.hide, YAHOO.example.container.overlay3, true);

} YAHOO.util.Event.onDOMReady(init); </script>

overlay1 (fade in): <button id="show1">Show</button> <button id="hide1">Hide</button>

overlay2 (slide in): <button id="show2">Show</button> <button id="hide2">Hide</button>

overlay3 (fade and slide): <button id="show3">Show</button> <button id="hide3">Hide</button>

</body> </html>


 </source>
   
  

<A href="http://www.wbex.ru/Code/JavaScriptDownload/yui_2.7.0b.zip">yui_2.7.0b.zip( 4,431 k)</a>


ContainerEffect Transitions: fly in and fly out

   <source lang="html4strict">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head>

   <meta http-equiv="content-type" content="text/html; charset=utf-8">

<title>Using ContainerEffect Transitions</title> <style type="text/css"> /*margin and padding on body element

 can introduce errors in determining
 element position and are not recommended;
 we turn them off as a foundation for YUI
 CSS treatments. */

body {

 margin:0;
 padding:0;

} </style> <link rel="stylesheet" type="text/css" href="yui_2.7.0b-lib/fonts/fonts-min.css" /> <link rel="stylesheet" type="text/css" href="yui_2.7.0b-lib/container/assets/skins/sam/container.css" /> <script type="text/javascript" src="yui_2.7.0b-lib/yahoo-dom-event/yahoo-dom-event.js"></script> <script type="text/javascript" src="yui_2.7.0b-lib/animation/animation-min.js"></script> <script type="text/javascript" src="yui_2.7.0b-lib/container/container-min.js"></script>

</head> <body class=" yui-skin-sam">

Using ContainerEffect Transitions

The <a href="http://developer.yahoo.ru/yui/container/">Container Family</a> of controls, including <a href="http://developer.yahoo.ru/yui/container/overlay/">Overlay</a> and all of its subclasses (<a href="http://developer.yahoo.ru/yui/container/panel/">Panel</a>, <a href="http://developer.yahoo.ru/yui/container/tooltip/">Tooltip</a>, <a href="http://developer.yahoo.ru/yui/container/dialog/">Dialog</a>, <a href="http://developer.yahoo.ru/yui/container/simpledialog/">SimpleDialog</a>), can implement built-in transition effects using the effect property and the <a href="http://developer.yahoo.ru/yui/docs/YAHOO.widget.ContainerEffect.html">ContainerEffect</a> object. This example demonstrates the fade and slide transitions provided with Container.

Use the buttons below to show and hide Overlays, noting their transition treatments as they appear and disappear.

<style> .yui-overlay { position:absolute;border:1px dotted black;padding:5px;margin:10px;background:#fff; } .yui-overlay .hd { border:1px solid red;padding:5px; } .yui-overlay .bd { border:1px solid green;padding:5px; } .yui-overlay .ft { border:1px solid blue;padding:5px; } </style> <script> YAHOO.namespace("example.container"); function init() {

 // Build overlay1 based on markup
 YAHOO.example.container.overlay1 = new YAHOO.widget.Overlay("overlay1", { xy:[350,100],
                                       visible:false,
                                       width:"300px",
                                       zIndex:1000,
                                       effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );
 YAHOO.example.container.overlay1.render("example");
 // Build overlay2 based on markup
 YAHOO.example.container.overlay2 = new YAHOO.widget.Overlay("overlay2", { xy:[350,100],
                                       visible:false,
                                       width:"300px",
                                       zIndex:1000,
                                       effect:{effect:YAHOO.widget.ContainerEffect.SLIDE,duration:0.25} } );
 YAHOO.example.container.overlay2.render("example");
 // Build overlay3 based on markup
 YAHOO.example.container.overlay3 = new YAHOO.widget.Overlay("overlay3", { xy:[350,100],
                                       visible:false,
                                       width:"300px",
                                       zIndex:1000,
                                       effect:[{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5},
                                           {effect:YAHOO.widget.ContainerEffect.SLIDE,duration:0.5}] } );
 YAHOO.example.container.overlay3.render("example");
 YAHOO.util.Event.addListener("show1", "click", YAHOO.example.container.overlay1.show, YAHOO.example.container.overlay1, true);
 YAHOO.util.Event.addListener("hide1", "click", YAHOO.example.container.overlay1.hide, YAHOO.example.container.overlay1, true);
 YAHOO.util.Event.addListener("show2", "click", YAHOO.example.container.overlay2.show, YAHOO.example.container.overlay2, true);
 YAHOO.util.Event.addListener("hide2", "click", YAHOO.example.container.overlay2.hide, YAHOO.example.container.overlay2, true);
 YAHOO.util.Event.addListener("show3", "click", YAHOO.example.container.overlay3.show, YAHOO.example.container.overlay3, true);
 YAHOO.util.Event.addListener("hide3", "click", YAHOO.example.container.overlay3.hide, YAHOO.example.container.overlay3, true);

} YAHOO.util.Event.onDOMReady(init); </script>

overlay1 (fade in): <button id="show1">Show</button> <button id="hide1">Hide</button>

overlay2 (slide in): <button id="show2">Show</button> <button id="hide2">Hide</button>

overlay3 (fade and slide): <button id="show3">Show</button> <button id="hide3">Hide</button>

</body> </html>


 </source>
   
  

<A href="http://www.wbex.ru/Code/JavaScriptDownload/yui_2.7.0b.zip">yui_2.7.0b.zip( 4,431 k)</a>