browse.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. $(function()
  2. {
  3. setTimeout(function()
  4. {
  5. fixScroll();
  6. }, 500);
  7. })
  8. function fixScroll()
  9. {
  10. var $scrollwrapper = $('div.datatable').first().find('.scroll-wrapper:first');
  11. if($scrollwrapper.size() == 0)return;
  12. var $tfoot = $('div.datatable').first().find('table tfoot:last');
  13. var scrollOffset = $scrollwrapper.offset().top + $scrollwrapper.find('.scroll-slide').height();
  14. if($tfoot.size() > 0) scrollOffset += $tfoot.height();
  15. if($('div.datatable.head-fixed').size() == 0) scrollOffset -= '29';
  16. var windowH = $(window).height();
  17. if(scrollOffset > windowH + $(window).scrollTop()) $scrollwrapper.css({'position': 'fixed', 'bottom': 50 + 'px'});
  18. $(window).scroll(function()
  19. {
  20. newBottom = $tfoot.hasClass('fixedTfootAction') ? 50 + $tfoot.height() : 50;
  21. if(typeof(ssoRedirect) != "undefined") newBottom = 50;
  22. if(scrollOffset <= windowH + $(window).scrollTop())
  23. {
  24. $scrollwrapper.css({'position':'relative', 'bottom': '0px'});
  25. }
  26. else if($scrollwrapper.css('position') != 'fixed')
  27. {
  28. $scrollwrapper.css({'position': 'fixed', 'bottom': newBottom + 'px'});
  29. bottom = newBottom;
  30. }
  31. });
  32. }