Is it possible in Jquery/jscript to get text that is currently being shown on the screen, ie. Don't get text that has display visible or similar type of property but isnt currently shown on the screen (ie. the user has to use scrollbar to view that text)
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
The problem is that text nodes (
nodeType 3
) don't have mapped space on the screen so we need to wrap all the words with elements (nodeType 1
) so we can find theposition()
.Sample HTML Text:
JQuery manipulation:
It's not a complete solution but it should get you started in the right direction.
Demo: http://jsfiddle.net/AlienWebguy/LnYff/