-
-
Save parasharrajat/cfc0ce67d174507e58e03ebf1fac15be to your computer and use it in GitHub Desktop.
Revisions
-
joshwnj revised this gist
Oct 19, 2010 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,14 @@ var TextOverflow = { crop: function(elm) { var w = elm.width(), t = elm.text(), child; elm.html('<span style="overflow: hidden; white-space: nowrap">'+t+'</span>'); child = elm.children(":first-child"); while (t.length > 0 && child.width() > w) { t = t.substr(0, t.length - 1); child.html(t + '<span class="ellipsis">…</span>'); } } }; -
joshwnj renamed this gist
Oct 19, 2010 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
joshwnj created this gist
Oct 18, 2010 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ var TextOverflow = { crop: function(elm) { var w = elm.width(), h = elm.height(), t = elm.text(), child; elm.html('<span>'+t+'</span>'); child = elm.children(":first-child"); while (t.length > 0 && elm[0].scrollHeight > h) { t = t.substr(0, t.length - 1); child.html(t + '<span class="ellipsis">…</span>'); } } };