JSFiddle - React, Tailwind, and code Playground

HTML

<div class="page">
    <div class="element">
    </div>
</div>

CSS

.page {
    overflow: hidden;
    width: 200px;
    height: 200px;
    position: relative;
    background: black;
}
.element {
    width: 100px;
    height: 100px;
    position: absolute;
    background: blue;
    top: 10px;
    left: 150px;
}

JavaScript

var pageWidth = $(".page").width();
var elementWidth = $(".element").width();
var elementLeft = $(".element").position().left;

if (pageWidth - (elementWidth + elementLeft) < 0) {
    alert("overflow!");
} else {
    alert("doesn't overflow");
}