Last active
May 16, 2019 01:00
-
-
Save zaidaldabbagh/a4141582068608c80a1092c411a8e98b to your computer and use it in GitHub Desktop.
Script to identify if content of a particular div is overflowing — See https://stackoverflow.com/questions/143815/determine-if-an-html-elements-content-overflows.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add overflowing text indicator for cards with longer texts | |
var win2dOptionValues = document.getElementsByClassName('win2dOption-value'); | |
for (var i=0; i < win2dOptionValues.length; i++) { | |
var curOverflow = win2dOptionValues[i].style.overflow; | |
var isOverflowing = win2dOptionValues[i].clientWidth < win2dOptionValues[i].scrollWidth || | |
win2dOptionValues[i].clientHeight < win2dOptionValues[i].scrollHeight; | |
if (isOverflowing) { | |
win2dOptionValues[i].className += " win2dOption-value--overflowing"; | |
win2dOptionValues[i].style.overflowy = "scroll"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment