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

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

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

cumulativeOffset():
goTo: function(){
...cut...
/* We are looking to scroll to the DT so we
need its position */
this.scrolling_to = Position.cumulativeOffset( this.getDT() );
trace( 'DT position: '+ this.scrolling_to[0] + ',' + this.scrolling_to[1] );
this.scroll();
this.open();
},
...cut...
getDT: function(){
trace( 'looking for the DT associated with ' + this.to_open );
var el = $( this.to_open ).previousSibling;
while( el.nodeName.toLowerCase() != 'dt' ){
el = el.previousSibling;
}
return el;
},
And because you have implemented process handling, you can safely call FAQ.open()
from within FAQ.goTo() without causing conflict with the call to FAQ.scroll() just ahead of it.
You??™re in the final stretch now; you just have a little cleanup left to do.
CHAPTER 8 n CASE STUDY: FAQ FACELIFT 185
Time to Tidy Up a Bit
Because you??™re invoking the scroll before you open the targeted answer, you can sometimes
end up with a little extra room to scroll after the answer is fully open. To compensate for this,
you can set the FAQ.complete() method to attempt a little more of a scroll just in case it??™s
available:
complete: function( dd ){
...cut...
if( this.to_open == id ){
this.open_items.push( id );
// run the scroll again (just in case the page has changed)
this.scrolling_to = Position.cumulativeOffset( this.getDT() );
this.scroll();
} else {
this.open_items = this.open_items.


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