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 248 | Next

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

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

heightFX.custom( dd.openHeight, 0 );
}.bind( this ) );
}
this.goTo();
},
complete: function( dd ){
...cut...
this.processes = this.processes.without( id );
},
nNote You can safely skip adding the open process to the list because in this example FAQ.open() will
always be the last method called.
6. If you save the script, refresh your browser, and click a few links, you??™ll see open
answers close before new ones are opened. Perfect.
Now, you??™ve got some scrollin??™ to do.
Getting Things Scrolling
The scrolling effect is actually quite simple and involves only a few of the methods.
FAQ.getScrollLeft() and FAQ.getScrollTop(), which obtain the current scroll position, have
already been provided for you, which enables you to jump right into FAQ.scroll().
1. FAQ.scroll() will handle the scrolling of the page from start to finish, and because you
have FAQ.processes to tell you what??™s going on, this method can easily determine
whether it is starting the scroll or in the midst of it. FAQ.scroll() will also be able to tell
when it should stop scrolling by comparing the current scroll position (determined by
using FAQ.getScrollLeft() and FAQ.getScrollTop()) to its intended destination. You??™ll
also cache the current scroll position in FAQ.scroll_cache, so you can easily determine
whether the window just won??™t scroll any more (that is, you are at the bottom or top of
the window):
scroll: function(){
if( this.


Pages:
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260