Index: trunk/extensions/LiquidThreads/lqt.js |
— | — | @@ -1,5 +1,6 @@ |
2 | 2 | var liquidThreads = { |
3 | 3 | currentReplyThread : null, |
| 4 | + currentToolbar : null, |
4 | 5 | |
5 | 6 | 'handleReplyLink' : function(e) { |
6 | 7 | if (e.preventDefault) |
— | — | @@ -207,8 +208,14 @@ |
208 | 209 | post.hover( |
209 | 210 | function() { |
210 | 211 | toolbar.fadeIn(100); |
211 | | - } /*over*/, |
| 212 | + liquidThreads.currentToolbar = toolbar; |
| 213 | + } /* over */, |
212 | 214 | function() { |
| 215 | + if ( liquidThreads.currentToolbar && |
| 216 | + liquidThreads.currentToolbar.is(toolbar) ) { |
| 217 | + liquidThreads.currentToolbar = null; |
| 218 | + } |
| 219 | + |
213 | 220 | toolbar.fadeOut(20); |
214 | 221 | }/*out */ ); |
215 | 222 | |
— | — | @@ -304,6 +311,28 @@ |
305 | 312 | // Move menus into their proper location |
306 | 313 | $j('div.lqt-post-wrapper').each( liquidThreads.setupMenus ); |
307 | 314 | |
| 315 | + // Add scrolling handler |
| 316 | + $j(document).scroll( function() { |
| 317 | + var toolbar = liquidThreads.currentToolbar; |
| 318 | + if ( !toolbar ) { return; } |
| 319 | + |
| 320 | + var post = toolbar.closest('.lqt_thread'); |
| 321 | + var scrollTop = $j(document).scrollTop(); |
| 322 | + var toolbarTop = toolbar.offset().top; |
| 323 | + var postTop = post.offset().top; |
| 324 | + |
| 325 | + if ( scrollTop > toolbarTop ) { |
| 326 | + toolbar.css( 'top', scrollTop ); |
| 327 | + } else if ( toolbar.css('top') && scrollTop < toolbarTop ) { |
| 328 | + // Move back either to the start of the post, or to the scroll point |
| 329 | + if ( scrollTop > postTop ) { |
| 330 | + toolbar.css( 'top', scrollTop ); |
| 331 | + } else { |
| 332 | + toolbar.css( 'top', 'auto' ); |
| 333 | + } |
| 334 | + } |
| 335 | + } ); |
| 336 | + |
308 | 337 | // Show quote buttons |
309 | 338 | liquidThreads.showQuoteButtons(); |
310 | 339 | |