html - ON/OFF css class in javascript - for animation handling -


i know how implement java script allows me add css class element when scroll , remove when stop scrolling. on/off situation

try this:

$(window).on('scroll', function() {   $('#someid').addclass('red'); });  $(window).scroll(function() {   cleartimeout($.data(this, 'scrolltimer'));   $.data(this, 'scrolltimer', settimeout(function() {     $('#someid').removeclass('red');   }, 250)); }); 

class .red adds red color testing.

you can test here https://jsfiddle.net/byxpsnwu/

i used this answer.