Closed simonferndriger closed 9 years ago
CSS
.is-clickable { cursor:pointer !important; } .is-cut { white-space:nowrap !important; overflow:hidden !important; text-overflow:ellipsis !important; }
JavaScript
var $CSS = { active: 'is-cut', dynamic: 'is-clickable' }; var fittext = function($scope, static){ var $texts = $($scope || $(document)).find('.fittext') ; $texts.addClass($CSS.active); if(static) return; //¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬ // Toggle //¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬ $texts .addClass($CSS.dynamic) .click(function(){ $(this).toggleClass($CSS.active); }) ; };
text-overflow:ellipsis does not work for multiline text, that's the main draw of this plugin.
text-overflow:ellipsis
OK, thank you for this info.
However, in our case, we found that single line overflow cut is sufficient.
CSS
JavaScript