Topping Use by Ice Cream Flavor

FlavorNo ToppingsChocolate SprinklesCrushed OreosCrushed Waffle ConeGranolaGummy BearsRainbow SprinklesTotal
Chocolate235184200581431122844
Vanilla16921128760142442381151
Cookies 'n' Cream402881103415970728
Pumpkin26246319222220475
Black Cherry14293281282581389
Pistachio10436213319318234
Rainbow Sherbert17730222841537313

OMG, Here's what it Does

  1. It takes your table, and the width and height you want the table to fit in (in this example, 1000×200)
  2. It adds two columns for the scroll buttons, and attaches click handlers
  3. It finds the width()s and outerWidth()s of every column, and remembers them
  4. It determines the pixel size of a scrollbar UI element
  5. It creates a container div which contains a table for the header row, and a div containing a table with the body rows
  6. A mousewheel listener is attached to the containing div, to capture left and right mousewheel tilts (some mice do this! like mine! :P)
  7. The new tables are given the classes of the original table
  8. The body table's div is given overflow: auto; to enable up-down scrolling
  9. The container div has the width and height you specify; the tables have a width equal to the specified width minus the width of a scrollbar
  10. Any columns before the x scroll index are hidden (this index is changed when the left/right links or mouse tilt is used)
  11. Any columns after the x scroll index which do not fit are hidden
  12. The column containing the right arrow button is given additional width, if necessary, to make the table fit the width
  13. The left and right arrow buttons are dimmed whenever clicking them would have no effect

Known Issues

License

Copyright (c) 2012 Ben Hendel-Doying

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.