SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 247 | Next

Jonathan Snook, Aaron Gustafson, Stuart Langridge, and Dan Webb

"Accelerated DOM Scripting with Ajax, APIs, and Libraries"

timer[ method ] = setTimeout( 'FAQ.' + method + '()', 10 );
return false;
},
3. Implementation of these methods is pretty straightforward. You??™ll start with
FAQ.open():
open: function(){
if( this.processing() ) return this.wait( 'open' );
clearTimeout( this.timer['open'] );
trace( 'open()' );
var dd = $( this.to_open );
dd.heightFX.custom( 0, dd.openHeight );
},
When FAQ.open() is called, it checks to see whether there are any active processes. If
there are, it waits and tries again 10ms later. Once the coast is clear, the timer (which is
stored as part of the FAQ.timer object) gets the axe, and the script proceeds normally.
4. Take a minute and implement this for FAQ.closeAndGo() and FAQ.goTo():
closeAndGo: function(){
if( this.processing() ) return this.wait( 'closeAndGo' );
clearInterval( this.timer['closeAndGo'] );
trace( 'need to close '+this.open_items.length+' dds' );
...cut...
},
...cut...
goTo: function(){
if( this.processing() ) return this.wait( 'goTo' );
clearInterval( this.timer['goTo'] );
trace( 'goTo()' );
...cut...
},
5. With that done, you can set up the addition and removal of the dd closing processes
(you??™ll add the scroll ones in a minute):
closeAndGo: function(){
...cut...
if( this.open_items.length > 0 ){
$A( this.open_items ).each( function( id ){
trace( 'closing ' + id );
this.processes.push( id );
CHAPTER 8 n CASE STUDY: FAQ FACELIFT 183
var dd = $( id );
dd.


Pages:
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6