1

Consider:

<div class="toggler">Toggler</div>
<div class="togglable">Lorem ipsum dolor</div>
<script>
    $('.togglable').hide();
    $('.toggler').click(function(){ $(this).sibling('.togglable').toggle(); });
</script>

The biggest drawback to collapsible content is the inability to easily search inside collapsed content when using Ctrl+F or F3 (let alone, visually "skimming" the page). What I'm thinking might be really useful is to display all collapsed content on a page whenever the browsers "Find on Page" bar is active.

Question:

Is there a way to detect if the "Find on Page" bar is active? Short of just adding listeners for Ctrl+F and F3 (which is a poor option anyways)?

Community
  • 1
  • 1
Phil Tune
  • 3,154
  • 3
  • 24
  • 46
  • @EdCottrell thanks for the link... I'm not sure that his question was answered, though. The suggestions were to use keypress listeners, which does not actually confirm that "Find on Page" is _active_. (The feature may have already been active before Javascript loaded, etc.) I'm wondering if _any_ browsers reveal some indicator to Javascript. – Phil Tune Jul 22 '14 at 18:50
  • 1
    The answer is that you can't do it, at least not in a cross-browser-compatible manner. I'd be very surprised if any browser revealed that info. – elixenide Jul 22 '14 at 18:51
  • Sounds good. Perhaps I could still include the listeners as just a quick site shortcut to view all collapsed content. Thanks, Ed! Care to throw that in an answer and I'll accept it. – Phil Tune Jul 22 '14 at 18:53
  • 1
    If you can detect it, either it's a bug or there's a security issue. However in some browsers you might able to detect it by listening to `resize` (extremely not reliable though). – Derek 朕會功夫 Jul 22 '14 at 19:03
  • "I'm not sure that his question was answered, though." Re-asking the question is **not** the right way to go about it, then. What you should do instead is to offer a bounty on the original question that duplicates yours. – Kuba hasn't forgotten Monica Jul 22 '14 at 19:39

0 Answers0