JSFiddle - React, Tailwind, and code Playground
HTML
<div id="01">mydiv</div>
JavaScript
var resizeId;
function resizingDone() {
w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
console.log(w);
if (w < 992) {
$('#01').on('click', function() {
console.log('click');
});
$('#01').off('hover');
} else {
$('#01').off('click');
$('#01').hover(function() {
console.log('hover');
});
}
}
$(window).resize(function() {
clearTimeout(resizeId);
resizeId = setTimeout(resizingDone, 500);
});
resizingDone();