Waypoints Add-on for Vaadin 7
This is an add-on for Vaadin 7 providing a wrapper for the JavaScript library ‘Waypoints’. You can check out the original library on
http://imakewebthings.com/waypoints/
With this add-on you can receive events when you scroll to a Vaadin component.
The source code can be found at
Features
- Receive events when element is scrolled into viewport.
- Can set offset (top, middle, bottom, absolute, relative or a JavaScript function) of viewport where event should be fired
- Can enable or disable the extension at runtime
- Event has info about the scroll direction and the source on which the event occurs
- Scrollable contexts can be one on UI, Panel, Window, Table, Tabsheet, Acordion, VerticalSplitPanel or HorizontalSplitPanel
- Use shortcut ‘Inview’ to receive info when element enters, entered, leaves and left the viewport
- Option to scroll into a Vaadin component (using GitHub - kswedberg/jquery-smooth-scroll: Automatically make same-page links scroll smoothly)
Getting started
See the provided code examples for a quick start.
For a more comprehensive example, see the demo project at GitHub - christiandusse/vaadin-waypoints: Vaadin wrapper for the javascript library 'Waypoints' (http://imakewebthings.com/waypoints/)
Online demo
Try the add-on demo at http://env-9019740.jelastic.servint.net/waypoints-demo/ (may take a while to load)
Known issues:
- May lead to infinite loop when scrolling fast while having set a lot of waypoints
- May not receive events on browser size change
- May receive wrong events when having multiple scrollbars in the hierarchy of the extended component
- May receive wrong events for components inside a table
- No support for cells inside a Vaadin grid
Roadmap
This component is developed as a hobby with no public roadmap or any guarantees of upcoming releases. That said, the following features are planned for upcoming releases:
- Sticky Elements: Sticky Elements • Waypoints
- Support for cells inside a Vaadin grid
- Events on scrolling because of browser size change
- Settings options lazily
- Provide more options from original library: ‘group’, ‘continuous’ Waypoint Class • Waypoints
- Performance optimization (f.e. option to only receive the last event when scrolling over multiple waypoints at once)
- Better documentation
- Integration tests