Giant Jam Sandwich wrote:
Well, I have vastly improved this script. It was my first plugin for
jQuery, and after creating a few others, I decided to go back and make
some edits on this one. You can find the demo here:
http://reindel.com/blog/src/jquery_truncate/
Nice!
An interesting variant on this would be one that called something like
the following on document ready:
$("p.truncate").truncate(100, /\s/);
With markup that looked like
<p class="truncate">TEHRAN, Iran - President Mahmoud Ahmadinejad
defused a growing confrontation with Britain, announcing the
surprise release of 15 captive British sailors
<a class="more" href="http://news.yahoo.com...">more...</a>
</p>
This might be a little tricky to do right, but would degrade quite
gracefully.
Thanks for sharing this,
-- Scott