JSFiddle - React, Tailwind, and code Playground

by OriginalEXE

HTML

<div id="message">Neki text</div>

Neki drugi content

CSS

#message {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ff0000;
}

JavaScript

jQuery( function( $ ) {
    
    var $window = $( window ),
        $message = $( '#message' );
    
    function check_orientation() {
        
        if ( $window.width() > $window.height() ) {
            
            $message.show();
            
        } else {
            
            $message.hide();
            
        }
        
    }
    
    check_orientation();
    
    $window.resize( check_orientation );
    
});