opening a tab using an image link instead of the actual tab
in Using jQuery
•
13 years ago
Please forgive me, as I am pretty new at Javascript, but I need to learn
Anyways, i use the Jquery UI Tabs plugin for navigation within a page on my website. I have two tabs on this page and I would like to have one image at the bottom of the first tab content that just simply opens the second tabbed content.
I read this wiki on the documentation section of the plugin page:
This had me pretty confused. ..select a tab from a text link instead of clicking a tab itself
var $tabs = $('#example').tabs(); // first tab selected $('#my-text-link').click(function() { // bind click event to link $tabs.tabs('select', 2); // switch to third tab return false; });
This is the code that I have for the image (it also uses a simple javascript image hover effect on it as well)
So when I read the the above wiki, i assumed that you put it in head like this:
Where i used the id of the image as the first "blind click event to link" and the name of the first tab that is opened when you view the page as "tab1" and the name/id of the tab that I would like to open on click is tab2
this is my basic code setup:
- <div id="tab1" class="tabContent">
- <div class="scroll-paneContact">
- MAIN CONTENT GOES HERE
- <a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('consultation','','../weddings/pagegraphics/consult_b.png',1)"><span><img src="../weddings/pagegraphics/consult_a.gif" alt="set up a consultation now" name="consultation" width="293" height="36" border="0" id="consultation" align="right" /></span></a>
- </div><div>
- <div id="tab2" class="tabContent">
- <div class="scroll-paneContact" >
- FORM TO LINK TO FROM TAB1 GOES HERE
- </div></div>
So as you can see, I am pretty stuck. I'm sure i did something entirely wrong and misunderstood the instructions in the wiki doc. ANY help at all is GREATLY appreciated.
1