How to open a specific tab via an external link?

Linking to the correct page is simple enough, but the challenge is to open to the correct tab once you gain tbelow. On the around page scroll to the bottom and click the Move it icon (the one through the truck). This takes you to the move it page. This functions fine, yet I would certainly like it to be able to open the Specialty tab.

Here is the code that links to the page:

I tried this, but it does not occupational correctly

Here is the code for the tabs on the location page:


Moving Simplified specializes in relocating items such items as pool tables, pianos, antiques, and anypoint else you have the right to throw at us.

You watching: How to open a specific tab via an external link?


Watch the Move It Specialty Videos Now.

Moving such items is more complicated than a lot of would understand, and also is an art form in itself. We take pride in making sure that your pricemuch less possessions are yielded damage totally free. The employees sent out to move your belongings are extremely skilled in these types of items. They will certainly always be well equipped to complete the move through the many as much as day modern technology in the relocating industry.

We will constantly pad and also wrap each individual item, and also administer tradition cprices to ensure the security of your pool table slate.


Want to download the Move It Specialty guide? Go right here currently.

See more: Kicked By Punkbuster; Restriction: Service Communication Failure: Pnkbstra.Exe


Here is the jquery for operating the tabs:

$(document).ready(function() {/* this is for the tabbed content */$("a.tab").click(function( evt ) evt.preventDefault(); $(".active").removeClass("active"); $(this).addClass("active"); $(".content").slideUp(); var content_present = $(this).attr("id"); $("#" + content_display + "-content").slideDown(););Since I will should perform this on multiple link/tab combos I would choose to uncover a methodical technique.

Thanks for any type of help!


jquery
Share
Follow
asked Aug 12 "10 at 16:30
*

forrestforremainder
8,9942323 gold badges6464 silver badges115115 bronze badges
Add a comment |

5 Answers 5


Active Oldest Votes
8
+25
This is conveniently implemented making use of Ariel Flesler"s jQuery plugins together with the conventional jQuery UI Tabs widget:

You"ll find a in-depth "how to" in the blog posting at:

http://weblog.muledesign.com/2009/05/bookmarkable_tabs_with_jquery_ui.php

This approach calls for a minimal amount of code and also deserve to be generalised throughout all your pages.

First, set up tabs making use of the jQuery UI Tabs widacquire.

See more: Internet Connection Sharing Not Working Windows 10, Internet Sharing Stopped Working On Windows 10

Include the jQuery plugins on the peras that usage tabs:

Then add this (substituting "#tabs" for whatever div you"re using):

$(document).ready(function() if($("#tabs") && document.area.hash) $.scrollTo("#tabs"); $("#tabs ul").localScroll( target:"#tabs", duration:0, hash:true ););And that"s it!


Share
Follow
answered Aug 17 "10 at 21:15
*

Daniel KehoeDaniel Kehoe
10.8k66 gold badges5959 silver badges7979 bronze badges
2
Add a comment |
1
I newly tried to develop my very own tabs. I changed the code to fit your requirements, but I"m not certain if it works:

Make certain the id of your link is theexact same as what you put after the #

var curtab = window.location.href; // Get the url curtab = curtab.split("#"); // Split the url at # curtab = "#" + curtab<1>; // Placed the info after the # in a variable $("a.tab").each(function(i) // Loop via all links and compare tab from url via value in attach if(curtab == $(this).attr("href")) $(this).addClass("active"); // If they are the same, set that tab"s course to energetic );$("a.tab").click(function() // Select tab $(".active").removeClass("active"); // Select the a, remove course for every connect $(this).addClass("active"); // Select the clicked tab and also add an active course var tabtospeak to = $(this).children().attr("href"); // Var to select present clicked tab $(".content").slideUp; // Slide up all content $(tabtocall).slideDown("normal"); // Slide down the schosen content );Hope this helps!

Edit:

The code listed below is to set the tab link to energetic (view comment) based upon your structure.

$(".tabs a").each(function(i) // Loop through all the links if(curtab == $(this).attr("id")) // Compare the worth from the url through the id $(this).addClass("active"); // If equal include class energetic );