Every waypoint belongs to a
Group serves as a logical separation of groups of waypoints that comes into play with group-dependent options and methods, such as the continuous option, next method, and previous method. Groups also ensure the correct trigger order of waypoints when multiple waypoints are crossed in one check.
When a Context listening for scroll and resize events sees that a waypoint has been crossed, it doesn't immediately trigger it. Instead, it registers the waypoint as triggered with that waypoint's
Group. When the context is done with its checks, groups with marked waypoints go through the process of sorting the triggered waypoints and filtering them according to the
Groups are automatically created through the use of the group option. Because of this, you should not instantiate this class directly. Instead, a group should be accessed using a waypoint's group property.
Groups are a simple construct with only a few properties. Let's look at a few examples that use of them.
Groups only operate on a single axis. That means if you create a vertical
Waypoint with a group name of
"foo", and create a horizontal one with the same group name, you'll end up creating two different groups. They share the same name, but have a different
name property for a group is identical to the string provided as the group option.
waypoints property is an array of the
Waypoint instances that belong to this group. Beware that while the first, last, previous, and next methods guarantee the result comes from a properly sorted waypoint array, this property may be unsorted at any given time.