Requires

Provides

Scrollable.js

For all the scrollbars you always wanted

License:
Public domain (http://unlicense.org).
Authors:
Yaroslaff Fedin
  1. 23
  2. 24
  3. 25
  4. 26
  5. 27
  6. 28
  7. 29
  8. 30
  9. 31
  10. 32
  11. 33
  12. 34
  13. 35
  14. 36
  15. 37
  16. 38
  17. 39
  18. 40
  19. 41
  20. 42
  21. 43
  22. 44
  23. 45
  24. 46
  25. 47
  26. 48
  27. 49
  28. 50
  29. 51
  30. 52
  31. 53
  32. 54
  33. 55
  34. 56
  35. 57
  36. 58
  37. 59
  38. 60
  39. 61
  40. 62
  41. 63
  42. 64
  43. 65
  44. 66
  45. 67
  46. 68
  47. 69
LSD.Mixin.Scrollable = new Class({ behaviour: '[scrollable][scrollable!=false]', options: { events: { self: { resize: 'showScrollbars' }, element: { mousewheel: 'onMousewheel' } } }, onMousewheel: function(event) { var scrollbar = this.vertical || this.horizontal; if (scrollbar) scrollbar.track.element.fireEvent('mousewheel', event ); }, showScrollbars: function(size) { if (!size) size = this.size; var scrolled = document.id(this.getScrolled()); scrolled.setStyles(size) scrolled.setStyle('overflow', 'hidden'); if (size.width < scrolled.scrollWidth) { if (this.getHorizontalScrollbar().parentNode != this) this.horizontal.inject(this); this.horizontal.slider.set(this.horizontal.now) } else if (this.horizontal) this.horizontal.dispose(); if (size.height < scrolled.scrollHeight) { if (this.getVerticalScrollbar().parentNode != this) this.vertical.inject(this); this.vertical.slider.set(this.vertical.now) } else if (this.vertical) this.vertical.dispose(); }, getVerticalScrollbar: Macro.getter('vertical', function() { return this.buildLayout('scrollbar[mode=vertical]') }), getHorizontalScrollbar: Macro.getter('horizontal', function() { return this.buildLayout('scrollbar[mode=horizontal]') }), getScrolled: Macro.defaults(function() { return this.getWrapper(); }) });