¡@

Home 

2014/10/16 ¤W¤È 12:04:37

jquery Programming Glossary: lasttag

jQuery text truncation (read more style)

http://stackoverflow.com/questions/2248742/jquery-text-truncation-read-more-style

counter 0 Track how far we've come compared to limit var lastTag Hold a reference to the last opening tag var lastOpenTags .. i Store current iteration in a variable for convenience lastTag lastOpenTags lastOpenTags.length 1 Store last opening tag in.. if item.match ^ If 'item' is not a tag we have text if lastTag item.charAt 0 ' ' lastTag 1 .match span SPAN item item.substr..

jQuery text truncation (read more style)

http://stackoverflow.com/questions/2248742/jquery-text-truncation-read-more-style

154 Max characters though last word is retained in full var counter 0 Track how far we've come compared to limit var lastTag Hold a reference to the last opening tag var lastOpenTags Stores an array of all opening tags they get removed as tags.. Iterate over the array of tags and words. item theText i Store current iteration in a variable for convenience lastTag lastOpenTags lastOpenTags.length 1 Store last opening tag in a variable for convenience if item.match ^ If 'item' is not.. 1 Store last opening tag in a variable for convenience if item.match ^ If 'item' is not a tag we have text if lastTag item.charAt 0 ' ' lastTag 1 .match span SPAN item item.substr 1 Remove space from beginning of block elements like IE does..