jQuery 1.4 Animation Techniques - Index of
jQuery 1.4 Animation Techniques - Index of jQuery 1.4 Animation Techniques - Index of
The previous screenshot shows the blind in its fully-open state. [ 157 ] Chapter 6 What just happened? We set a click handler on the outer container which calls the toggle() method on the inner element. In the CSS we set the inner element to be hidden initially, so the first time the container element is clicked, the inner element will be shown. The clip effect The clip effect causes the element it is called upon to reduce in size vertically or horizontally until it disappears. Configuration options The configuration options we have at our disposal when using the clip effect allow us to control the direction in which the animation proceeds, and whether the element is shown or hidden: Option Default Usage direction "vertical" Sets the axis along which the element animates. mode "hide" Configures whether the element is hidden or shown. Other possible values are show, toggle, and effect.
Extended Animations with jQuery UI Time for action – clipping an element in and out This effect is billed as being similar to what happens to the picture when an old television set is turned off, so let's work that into our example. 1. Add the following elements to the of the template file: 2. Then use the following simple script at the bottom of the page: $("#tv").click(function() { $("#static").effect("clip"); }); 3. Save this file as clip.html. The stylesheet for this example is as follows: #tv { width:300px; height:269px; position:relative; cursor:pointer; background:url(../img/tv.png) no-repeat 0 0; } #bg { width:220px; height:180px; position:absolute; left:42px; top:30px; z-index:-2; background-color:#000; } #static { width:216px; height:178px; position:absolute; left:44px; top:31px; z-index:-1; background:url(../img/static.gif) no-repeat 0 0; } 4. Save this file in the css folder as clip.css. 5. When the page is run, we should be able to click anywhere on the television and see the effect run: [ 158 ]
- Page 128 and 129: [ 107 ] Chapter 5 What just happene
- Page 130 and 131: [ 109 ] Chapter 5 Although not esse
- Page 132 and 133: [ 111 ] Chapter 5 The previous scre
- Page 134 and 135: [ 113 ] Chapter 5 The styles we use
- Page 136 and 137: [ 115 ] Chapter 5 What just happene
- Page 138 and 139: }, html: copy, width: expander.widt
- Page 140 and 141: [ 119 ] Chapter 5 If the image alre
- Page 142 and 143: [ 121 ] Chapter 5 d. Two objects wh
- Page 144 and 145: [ 123 ] Chapter 5 text-align:center
- Page 146 and 147: [ 125 ] Chapter 5 What just happene
- Page 148 and 149: [ 127 ] Chapter 5 Finally, we retur
- Page 150 and 151: [ 129 ] Chapter 5 Once we've define
- Page 152 and 153: } }; $(config.selector).find("a").c
- Page 154 and 155: [ 133 ] Chapter 5 In the previous s
- Page 156: Have a go hero - extending the plug
- Page 159 and 160: Extended Animations with jQuery UI
- Page 161 and 162: Extended Animations with jQuery UI
- Page 163 and 164: Extended Animations with jQuery UI
- Page 165 and 166: Extended Animations with jQuery UI
- Page 167 and 168: Extended Animations with jQuery UI
- Page 169 and 170: Extended Animations with jQuery UI
- Page 171 and 172: Download from Wow! eBook Extended
- Page 173 and 174: Extended Animations with jQuery UI
- Page 175 and 176: Extended Animations with jQuery UI
- Page 177: Extended Animations with jQuery UI
- Page 181 and 182: Extended Animations with jQuery UI
- Page 183 and 184: Extended Animations with jQuery UI
- Page 185 and 186: Extended Animations with jQuery UI
- Page 187 and 188: Extended Animations with jQuery UI
- Page 189 and 190: Extended Animations with jQuery UI
- Page 191 and 192: Extended Animations with jQuery UI
- Page 193 and 194: Extended Animations with jQuery UI
- Page 195 and 196: Extended Animations with jQuery UI
- Page 197 and 198: Extended Animations with jQuery UI
- Page 199 and 200: Extended Animations with jQuery UI
- Page 201 and 202: Full Page Animations Can we animate
- Page 203 and 204: Full Page Animations display:block;
- Page 205 and 206: Download from Wow! eBook Full Page
- Page 207 and 208: Full Page Animations Have a go hero
- Page 209 and 210: Full Page Animations 4. Save this f
- Page 211 and 212: Full Page Animations 2. The bgpos c
- Page 213 and 214: Full Page Animations nav ul { margi
- Page 215 and 216: Full Page Animations screensize = {
- Page 217 and 218: Full Page Animations What just happ
- Page 219 and 220: Full Page Animations The second sec
- Page 221 and 222: Full Page Animations Pop quiz - cre
- Page 223 and 224: Full Page Animations Time for actio
- Page 225 and 226: Full Page Animations Next we define
Extended <strong>Animation</strong>s with <strong>jQuery</strong> UI<br />
Time for action – clipping an element in and out<br />
This effect is billed as being similar to what happens to the picture when an old television set<br />
is turned <strong>of</strong>f, so let's work that into our example.<br />
1. Add the following elements to the <strong>of</strong> the template file:<br />
<br />
<br />
<br />
<br />
2. Then use the following simple script at the bottom <strong>of</strong> the page:<br />
$("#tv").click(function() {<br />
$("#static").effect("clip");<br />
});<br />
3. Save this file as clip.html. The stylesheet for this example is as follows:<br />
#tv {<br />
width:300px; height:269px; position:relative; cursor:pointer;<br />
background:url(../img/tv.png) no-repeat 0 0;<br />
}<br />
#bg {<br />
width:220px; height:180px; position:absolute; left:42px;<br />
top:30px;<br />
z-index:-2; background-color:#000;<br />
}<br />
#static {<br />
width:216px; height:178px; position:absolute; left:44px;<br />
top:31px;<br />
z-index:-1; background:url(../img/static.gif) no-repeat 0 0;<br />
}<br />
4. Save this file in the css folder as clip.css.<br />
5. When the page is run, we should be able to click anywhere on the television and see<br />
the effect run:<br />
[ 158 ]