i'm using http://rockycode.com/blog/jquery-plugin-readmore/ trim long text , add "see more" link reveal text.
i love avoid cutting words, how that?
if limit 35, don't cut w...
but
if limit 35, don't cut word... (and in case, trim @ 38 , show hidden text 39th chtill end.
you can change abridge
function within plugin follows:
function abridge(elem) { var opts = elem.data("opts"); var txt = elem.html(); var len = opts.substr_len; var dots = "<span>" + opts.ellipses + "</span>"; var charatlen = txt.substr(len, 1); while (len < txt.length && !/\s/.test(charatlen)) { len++; charatlen = txt.substr(len, 1); } var shown = txt.substring(0, len) + dots; var hidden = '<span class="hidden" style="display:none;">' + txt.substring(len, txt.length) + '</span>'; elem.html(shown + hidden); }
...and behave desire. might want add option turn feature off , on, i'll leave you.
Comments
Post a Comment