Hello,
Is it possible to read the currently viewed/visible text in the viewport(in a scrollable body) of an html document?
Thanks, Prasad Kancharla
Hello,
Is it possible to read the currently viewed/visible text in the viewport(in a scrollable body) of an html document?
Thanks, Prasad Kancharla
The currently visible portion of a window is known as the viewport. In JavaScript, you can get the height and width of the viewport, and this will give you an idea of how big the user's window is. Then I guess you'd have to find the scroll offsets to find out how far down they have scrolled, then determine what elements there are in that location, then get their text value, do some math to adjust for text size etc... It doesn't seem easy...
Might I ask why?
jQuery can help with scroll offset, and viewport etc, but I'm not sure there is any easy way to find out what elements are "near" a particular offset.