Skip to content

Instantly share code, notes, and snippets.

@nuxodin
Last active May 10, 2022 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuxodin/4d3163253662baac593b2484311537f4 to your computer and use it in GitHub Desktop.
Save nuxodin/4d3163253662baac593b2484311537f4 to your computer and use it in GitHub Desktop.
if (!('onscrollend' in document.documentElement)) {
document.addEventListener('scroll',function(e){
var scrollPort = e.target
clearTimeout(scrollPort._scrollEndTimeout);
scrollPort._scrollEndTimeout = setTimeout(function () {
const event = new Event('scrollend');
Object.defineProperty(event,'snapTarget',{
get(){
return 'todo';
},
set(){}
})
scrollPort.dispatchEvent(event);
}, 100);
},true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment