简体   繁体   English

在隐藏的 div 中快速查找 (ctrl+f)

[英]Quick find (ctrl+f) inside hidden div

I have a page with tabs implemented, where the inactive tabs are hidden with display:none.我有一个带有选项卡的页面,其中不活动的选项卡用 display:none 隐藏。 Now I'm trying to find a way to search in these hidden divs using the browsers quickfind (ctrl+f / cmd+f)现在我试图找到一种使用浏览器快速查找 (ctrl+f / cmd+f) 在这些隐藏的 div 中搜索的方法

Is there eg a way to run javascript, whenever a user searches for something?每当用户搜索某些内容时,是否有例如运行 javascript 的方法? If for example a user searches for «template» and it's found only in one of the inactive tabs, I'd like to activate/show that tab.例如,如果用户搜索 «template» 并且仅在非活动选项卡之一中找到它,我想激活/显示该选项卡。

Is there a way?有办法吗? Or would I have to implement an own search filter?还是我必须实现自己的搜索过滤器?

Thanks!谢谢!

Well you can sure ask for the keyboard shortcuts but they can still use the browser menu to start searching.好吧,您肯定可以要求提供键盘快捷键,但他们仍然可以使用浏览器菜单开始搜索。

Wouldn't it be easier to use a different method to hide those tabs?使用不同的方法来隐藏这些选项卡不是更容易吗? Something like类似的东西

display: block;
height: 0;
width: 0;
overflow hidden;

for example (depends on you special markup/css of course)例如(当然取决于你的特殊标记/css)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM