Skip to content

Instantly share code, notes, and snippets.

@csilverman
Created June 6, 2021 22:47
Show Gist options
  • Save csilverman/69a387f8fac0f097461962ff29961962 to your computer and use it in GitHub Desktop.
Save csilverman/69a387f8fac0f097461962ff29961962 to your computer and use it in GitHub Desktop.
var discreteElements = document.getElementsByClassName('sticky-frame')
for (var i = 0; i < discreteElements.length; i++) {
new Waypoint({
element: discreteElements[i],
handler: function(direction) {
if ( direction == 'down' )
this.element.classList.add('stuck');
else
this.element.classList.remove('stuck');
},
// context: document.getElementById('page-content'),
offset: '0%'
});
new Waypoint({
element: discreteElements[i],
handler: function(direction) {
if ( direction == 'down' )
this.element.classList.remove('stuck');
else
this.element.classList.add('stuck');
},
// context: document.getElementById('page-content'),
offset: 'bottom-in-view'
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment