开发者

How to detect where the word is wrapped

开发者 https://www.devze.com 2023-03-05 20:56 出处:网络
I would like to add \'span\' tag on the beginning and \'/span\' on the end of each line of text as it is presented in the website and change it dynamically when a div containing such text is resized.

I would like to add 'span' tag on the beginning and '/span' on the end of each line of text as it is presented in the website and change it dynamically when a div containing such text is resized. The problem is that I don't know how to detect where the text is being wrapped - if I had such information it would be easy. So my question is: is there a way to determine where the text is wrapped using javascript? I have found a javascr开发者_如何学Goipt library which hyphenates the text in the site but I'm not sure how does it detect line wraps. The working example is here and it's source can be found here.


yes, this is like to Search For and Highlight Text.
using javascript you can learn it here:

Search For and Highlight Text

or here:

how-can-i-use-jquery-to-style-parts-of-all-instances-of-a-specific-word

just download/save the web page there and you can learn it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号