1

I'm trying to remove this class I added on resize end. How do I trigger an event when the user is done resizing with with vanilla JS

window.addEventListener('resize', throttle(() => {
  document.body.classList.add('testing');
}));
Phreak
  • 301
  • 4
  • 20
  • 3
    So, what does `throttle` do? Or this is the function you wish to have defined? Also define when the user is done resizing? Also, you rather seem to be adding the class instead of removing it – Icepickle Jun 23 '17 at 20:20
  • 1
    Note: the duplicate question mentions jQuery but the highest voted answer is vanilla JS. – Mike Cluck Jun 23 '17 at 20:26
  • Its a resource conscious resize callback – Phreak Jun 23 '17 at 20:26
  • @MikeC : Just because one answer may apply to two different questions, that doesn't mean the questions are duplicates. Also, the highest voted answer of that answer question is pretty well hidden if you sort your answer by date. [IMO, that makes closing this answer totally unhelpful](https://meta.stackoverflow.com/questions/351188/is-it-sufficient-for-one-answer-to-apply-to-two-questions-for-both-questions-to). – John Slegers Jun 23 '17 at 20:48
  • @JohnSlegers Why not? It's the same issue and, as far as I can tell, answers are sorted by votes by default. – Mike Cluck Jun 23 '17 at 20:50
  • 2
    The other question deals with jQuery. This one deals with vanilla JS. Just because ONE answer to that other question happens to be a vanilla JS answer, that doesnt mean both questions are duplicates, considering none of the many other answers to that so-calling duplicate are applicable here. Anyway, [it looks like the opinions on the matter are divided!](https://meta.stackoverflow.com/questions/351188/is-it-sufficient-for-one-answer-to-apply-to-two-questions-for-both-questions-to) – John Slegers Jun 23 '17 at 20:53
  • 1
    Actually, [this answer](https://stackoverflow.com/a/5490021/3231537) is exactly what the user is looking for, I think you are overthinking the question @JohnSlegers – Icepickle Jun 23 '17 at 21:21

0 Answers0