Skip to content

Instantly share code, notes, and snippets.

@nuxodin
Last active May 10, 2022 20:10
Show Gist options
  • 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