Now rather than always truncating when calling .update() we update the cached property as before but if the content was originally expanded we restore it at the end of the method.
We also split out the collapsed and truncated states into separate variables as they are individual properties of the object. It is sometimes useful to know when the content is truncated even though it is expanded for example.
This pull makes it much easier to recalculate truncations when the window is resized.
jQuery(window).on('resize', function () { $truncated.truncate('update'); });
Now rather than always truncating when calling .update() we update the cached property as before but if the content was originally expanded we restore it at the end of the method.
We also split out the collapsed and truncated states into separate variables as they are individual properties of the object. It is sometimes useful to know when the content is truncated even though it is expanded for example.
This pull makes it much easier to recalculate truncations when the window is resized.