continuous option

Default

true

Possible Values

true or false.

The continuous option applies when a single scroll event would trigger multiple waypoints. A common case for this is if you're linking to a page fragment further down the page. In this first example, we have waypoints with continuous set to the default of true. If you click the link to jump past them you'll see they all trigger in order.

var continuousElements = document.getElementsByClassName('continuous-true')
for (var i = 0; i < continuousElements.length; i++) {
  new Waypoint({
    element: continuousElements[i],
    handler: function() {
      notify(this.element.innerHTML + ' hit')
    }
  })
}

Jump Past Continuous Waypoints

Continuous 1
Continuous 2
Continuous 3
Continuous 4
Continuous 5
Continuous 6
Continuous 7
Continuous 8
Continuous 9
Continuous 10
Continuous 11
Continuous 12
Continuous 13
Continuous 14
Continuous 15
Continuous 16
Continuous 17
Continuous 18
Continuous 19
Continuous 20

If we set all of these waypoints to continuous: false and make the same jump you'll see only the last waypoint is triggered.

var discreteElements = document.getElementsByClassName('continuous-false')
for (var i = 0; i < discreteElements.length; i++) {
  new Waypoint({
    element: discreteElements[i],
    handler: function() {
      notify(this.element.innerHTML + ' hit')
    },
    continuous: false
  })
}

Jump Past Non-Continuous Waypoints

Non-Continuous 1
Non-Continuous 2
Non-Continuous 3
Non-Continuous 4
Non-Continuous 5
Non-Continuous 6
Non-Continuous 7
Non-Continuous 8
Non-Continuous 9
Non-Continuous 10
Non-Continuous 11
Non-Continuous 12
Non-Continuous 13
Non-Continuous 14
Non-Continuous 15
Non-Continuous 16
Non-Continuous 17
Non-Continuous 18
Non-Continuous 19
Non-Continuous 20

Continuous is a property that is evaluated in the context of a waypoint's group. That is, if you cross multiple waypoints and they all have continuous set to false, but belong to different groups, they will all still fire. The last waypoint for each group is triggered. In the example below we have two different waypoint groups, both containing all waypoints with continuous false. You'll see the last waypoint from each group fires when making the jump.

var leftElements = document.getElementsByClassName('continuous-group-left')
for (var i = 0; i < leftElements.length; i++) {
  new Waypoint({
    element: leftElements[i],
    handler: function() {
      notify(this.element.innerHTML + ' hit')
    },
    continuous: false
  })
}

var rightElements = document.getElementsByClassName('continuous-group-right')
for (var i = 0; i < rightElements.length; i++) {
  new Waypoint({
    element: rightElements[i],
    handler: function() {
      notify(this.element.innerHTML + ' hit')
    },
    continuous: false
  })
}

Jump Past Waypoint Groups

Non-Continuous Left 1
Non-Continuous Left 2
Non-Continuous Left 3
Non-Continuous Left 4
Non-Continuous Left 5
Non-Continuous Left 6
Non-Continuous Left 7
Non-Continuous Left 8
Non-Continuous Left 9
Non-Continuous Left 10
Non-Continuous Right 1
Non-Continuous Right 2
Non-Continuous Right 3
Non-Continuous Right 4
Non-Continuous Right 5
Non-Continuous Right 6
Non-Continuous Right 7
Non-Continuous Right 8
Non-Continuous Right 9
Non-Continuous Right 10

It's easy to think about continuous in the following way: If we cross a bunch of waypoints in one scroll, only trigger the last one. This can be the case if every waypoint has continuous set to false, but it isn't exactly what's happening. Continuous is a property of an individual waypoint, and whether that waypoint is triggered is dependent only on its own continuous setting and not that of other triggered waypoints. The more accurate way to think of continuous is: If this waypoint was crossed and its continuous setting is false, only trigger its handler if it was the last waypoint crossed in its group.

That's a dense bunch of text for a simple example. Here we have a bunch of waypoints with continuous false, except for two in the middle with continuous true. You'll notice the jump causes the last non-continuous waypoint to fire, as well as the continuous waypoints in the middle.

var continuousElements = document.getElementsByClassName('continuous-mix-true')
for (var i = 0; i < continuousElements.length; i++) {
  new Waypoint({
    element: continuousElements[i],
    handler: function() {
      notify(this.element.innerHTML + ' hit')
    },
    offset: 'bottom-in-view'
  })
}

var discreteElements = document.getElementsByClassName('continuous-mix-false')
for (var i = 0; i < discreteElements.length; i++) {
  new Waypoint({
    element: discreteElements[i],
    handler: function() {
      notify(this.element.innerHTML + ' hit')
    },
    offset: 'bottom-in-view',
    continuous: false
  })
}

Jump Past Mixed Waypoints

Mix 1: Non-Continuous
Mix 2: Non-Continuous
Mix 3: Continuous
Mix 4: Non-Continuous
Mix 5: Non-Continuous
Mix 6: Non-Continuous
Mix 7: Continuous
Mix 8: Non-Continuous
Mix 9: Non-Continuous
Mix 10: Non-Continuous