JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="indicator" />
JavaScript
var threshold = $(window).width();
var initialDiff = ($(window).width() > threshold) ? 1:-1;
$('#indicator').val($(window).width());
$(window).on('resize',function(e){
var w = $(window).width();
$('#indicator').val(w);
var currentDiff = w - threshold;
if(currentDiff*initialDiff < 0) {
initialDiff *= -1;
console.log("crossed");
doAction();
}
});
var doAction = function(){
$('#indicator').effect("highlight",{},2000);
};