link to tab from outside "tabs div" ...
I'm new to JQuery and having trouble trying to link to a tab from outside the tabs div;
...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; });
...
Here's my "tabs" code;
<script type="text/javascript">
$(function() {
$("#tabs").tabs();
});
</script>
...
<div id="tabs">
<ul>
<li><a href="#tabs-1">
Ensaios</a></li>
<li><a href="#tabs-2">
Sobre</a></li>
<li><a href="#tabs-3">
Contato</a></li>
</ul>
(...)
...
and here's the code from the text where I'm trying to link from;
<div id="sticky-anchor">
<div id="sticky">
Ensaios /
Sobre /
Contato</div>
</div>
I'm using another script on this div, could it be creating a conflict in anyway?
<script type="text/javascript">
function sticky_relocate() {
var window_top = $(window).scrollTop();
var div_top = $('#sticky-anchor').offset().top;
if (window_top > div_top)
$('#sticky').addClass('stick')
else
$('#sticky').removeClass('stick');
}
$(function() {
$(window).scroll(sticky_relocate);
sticky_relocate();
});
</script>
...
How do I link the text on this last div to the correspondent tabs at the "tabs div" ?
Would appreciate any help.