JSFiddle - React, Tailwind, and code Playground
by mrbinky3000
HTML
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<p>Resize the Window to see example work.</p>
</body>
</html>
JavaScript
var delay = (function() {
var timer = 0;
return function(callback, ms) {
clearTimeout(timer);
timer = setTimeout(callback, ms);
};
})();
$(document).ready(function() {
"use strict";
$(window).on('resize', function() {
var bob = new delay();
bob.constructor(function() {
alert('Do Thing 1');
}, 1000);
delay(function() {
alert('Do Thing 2');
}, 1000);
});
});