samsono / Easy-Responsive-Tabs-to-Accordion

Easy responsive tabs - is a lightweight jQuery plugin which optimizes normal horizontal or vertical tabs to accordion on multi devices like: web, tablets, Mobile (IPad & IPhone). This plugin adapts the screen size and changes its action accordingly.
Other
603 stars 259 forks source link

Linking from another page, tab open #5

Closed chipgrafx closed 10 years ago

chipgrafx commented 11 years ago

I think this is related to the "Open a specific tab using a link" issue that is already closed...

I have some navigation items on the homepage of a site. Each item (or Problem) links to a specific tab (or Solution) within a single Solutions page. Each tab is a solution to a different problem.

How can I do this so that when a Problem link is clicked the corresponding Solution tab is open when the page loads?

I am somewhat familiar with jQuery but I am by no means an expert. The answer to the previous issue similar to mine did not resolve my problem. Thanks for your help. These tabs are great!

ghost commented 11 years ago

Hi chipgrafx, did you manage to achieve this? I really need to do the same thing. Surely this can't be too difficult for the author to implement (he says, knowing hardly anything about JQuery)?

chipgrafx commented 11 years ago

kevsurf2003, I was not able to achieve this. We had to move forward with the project so clicking a Problem on the homepage simply takes you to the Solutions page but not to the specific Solution tab. Still waiting for the plugin author to chime in.

digiguru commented 10 years ago

I'm not the author, but we've been making some modifications. See #16 it's a way of "clicking links". An example is as follows:

$('[role="tab"]').has("a[href='#reviews']").first().trigger("click")

This says basically "Get all tabs" [role="tab"] that have a link called reviews a[href='#reviews'].

This will select 2 nodes, the accordion header and the list header. Next we select just the list: .first() and then trigger a click

Here is a helper function that would allow you to select any of the tabs by name.

function selectTab(tabname) {
    $('[role="tab"]').has("a[href='#" + tabname + "']").first().trigger("click");
}