waypoint.destroy()

Parameters

None.

Returns

The same Waypoint instance, allowing chained method calls.

Destroys the waypoint, preventing the handler from triggering ever again.

Scroll down to view examples.

var waypoint = new Waypoint({
  element: document.getElementById('destroy-example'),
  handler: function(direction) {
    notify('I am still alive')
  },
  offset: 'bottom-in-view'
})

$('button.destroy').on('click', function() {
  waypoint.destroy()
})

Previous versions of Waypoints included an option, triggerOnce, which would destroy a waypoint after the handler was triggered the first time. That option has been removed in favor of manually calling .destroy() at the end of the handler.

var waypoint = new Waypoint({
  element: document.getElementById('trigger-once-example'),
  handler: function(direction) {
    notify('Triggered once, now destroyed')
    this.destroy()
  },
  offset: 'bottom-in-view'
})