Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browser Ctrl+F find non-visible text

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.

like image 656
David Pilling Avatar asked Mar 25 '10 14:03

David Pilling


2 Answers

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.

like image 177
bobince Avatar answered Nov 10 '22 20:11

bobince


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.

like image 28
Chris Lercher Avatar answered Nov 10 '22 22:11

Chris Lercher