JSFiddle - React, Tailwind, and code Playground

by rwaldron

JavaScript

jQuery("body").data( "away", false );

jQuery( window ).bind( "blur focus", function( event ) {
    var state = {
        blur: true,
        focus: false  
    };

    jQuery("body").data( "away", state[ event.type ] );    
});


/*
When your comet message comes down the line...

// Window has focus
if ( !jQuery("body").data( "away" ) ) {
  // trigger the animation  
}

*/