JSFiddle - React, Tailwind, and code Playground

by Asad Ali Kanwal

HTML

<div class="popover-controls">
    <div style="background:red">
        Change the width Of this window
        Width is <span class="width"></span>
    </div>
</div>

JavaScript

$(function() {

function process(){ 
   $(".width").html($(window).width());
   if( $(window).width() > 600){
     $("body").removeClass("mobile").addClass("desktop");
    
   }else{
     $("body").removeClass("desktop").addClass("mobile");
   }

}
$(window).resize(function(){
    process()
});

 $(document).on('mouseover', 'body.mobile .popover-controls div',function(e){
            alert("hover");
        }); 

 $(document).on('click', 'body.desktop .popover-controls div',function(e){
            alert("click");
     console.log("click");
        }); 
    })