I wonder if we can select a specific tab in the jQuery tab from another page ..?
For example, I have 4 menus that are Home | About the project | Services | contact On the services page, I have a tab system with 5 tabs (Flight, Hotels, International Flight, Rail, Bus), so I come to the point that selects the bus link from the home page. I need to display Bus (visible by default - "Flight") on the services page.
I tried to give a link to a bus on a home page like this. services.php # tab4 (e.g. binding label method)
Unfortunately this does not work.
I am using the following jQuery for my tab system.
$(document).ready(function() { //When page loads... $(".tab_content").hide(); //Hide all content $("ul.tabs li:first").addClass("active_pr").show(); //Activate first tab $(".tab_content:first").show(); //Show first tab content //On Click Event $("ul.tabs li").click(function() { $("ul.tabs li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $(".tab_content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active ID content return false; }); });
link tabs on service pages defined in ul li as shown below
<ul class="tabs"> <li><a href="#tab1">Flight</li> <li><a href="#tab2">Hotels</a></li> <li><a href="#tab3">International Flight</a></li> <li><a href="#tab4">Rail</a></li> <li><a href="#tab5">Bus</a></li> </ul>
I hope someone can answer the above question.
thanks
Floor
source share