JSFiddle - React, Tailwind, and code Playground

HTML

<div id="x" style="width:400px;height:250px;background-color:green;"></div>

JavaScript

var $nav = $('#x');
var nav_width = $nav.width();
var THRESHOLD = 100;
$nav.bind('mouseover mousemove',function(e) {
    var offset = nav_width - (e.clientX - this.offsetLeft);
    console.log(offset);
    if(offset < THRESHOLD) {
      //mouse is within bounds...
      alert('within bounds');
   } 
});