简体   繁体   中英

Make search results take user to specific tab on page?

I have a Wordpress website I'm working on that uses jQuery tabs to separate information.

My client has pointed out that when a user uses the internal search and clicks on a result, the link does not take them to the specific tab that the info is on.

For example, if there are posters in tab #3 and the user searches for "posters", the search result link will take them to the correct page, but will have tab #1 open by default.

This makes it difficult for users to find what they're looking for. Is there any solution for this, or will we have to just do away with the tabs?

Here's the barebones code:

 <div class="tabs"> <ul> <li><a href="#apps">apps</a></li> <li><a href="#features">features</a></li> <li><a href="#faqs">faqs</a></li> </ul> <div id="apps"> </div> <div id="features"> </div> <div id="faqs"> </div> </div> <script type="text/javascript">jQuery(function() { jQuery(".tabs").tabs() });</script> 

If you know which tab the content is in:

// To open the third tab
jQuery('.tabs').tabs('options', 'active', 2);

I'd assume that a tab represents a category, so it should be easy enough to pass that to the results page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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