Browser Ctrl+F find non-visible text
Asked Answered
F

2

8

Can the browser feature of Ctrl+F to find text be integrated with text in popup windows.

I'd like to have some scientific reference information given when someone hovers over a species name in a web page. Generating the popup, tooltip style text is no problem, the problem is that anyone using Ctrl+F won't be able to find it, or if I position the text out of view when not required, it will be found but be invisible.

The same sort of effect applies to "accordion" style expanding text areas.

I'm looking for some sort of event generated when find is highlighting a result.

Forcier answered 25/3, 2010 at 14:20 Comment(0)
D
2

Unfortunately there is no such event, you can't interfere with the built-in find.

About the best you can do in this case is to provide your own search function in-page, which searches the DOM for Text nodes containing the given text, highlights them, and opens up any closed accordions they're in.

Derward answered 25/3, 2010 at 15:11 Comment(0)
T
1

The only idea I have, is to put all the text from your popups in one additional scrollbox (maybe at the bottom of the page) with a height just large enough to display one set of detail information at a time. This way, it doesn't take up too much space on the page, and the text can still be found using Ctrl+F.

Tollgate answered 26/3, 2010 at 21:36 Comment(2)
Thank you, that's helped me think about my problem. I can see various solutions now. One thing that might be assumed about browser find is that the browser will scroll the window so that the current find result is visible. I did a quick test on a div whose contents are bigger than its visible area and that was nicely scrolled by find in IE - but not by FF.Forcier
ps - Chrome and Safari scroll the div too.Forcier

© 2022 - 2024 — McMap. All rights reserved.