Skip to content

Instantly share code, notes, and snippets.

Last active October 15, 2016 18:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
// originaly based on code from
// improved to handle absolute positioned elements shifted to right making overflow happend.
function findOverflow(){
var docWidth = document.documentElement.offsetWidth;
function(el) {
var rect= el.getBoundingClientRect();
if (el.offsetWidth > docWidth ||rect.right>docWidth) {
findOverflow(); // call it as script loads. Also you can call it later manually from a console.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment