You can use on()
and off()
, but once the event handler is removed, it won't magically return once you've stopped scrolling, you would have to rebind it again with on()
.
$(function(){
var timer;
media_bind();
$(window).on('scroll', function(){
clearTimeout(timer);
$('.media-in').off('mouseover mouseout');
timer = setTimeout(media_bind, 500);
});
function media_bind() {
$('.media-in').on(
mouseover: function() {
$(this).children('.media-options').show();
},
mouseout: function() {
$(this).children('.media-options').hide();
}
});
}
});