So, this is one of those things where the goal is simple enough, but after all day I'm still stumped. Using drupal, I am trying to link to a named anchor inside of a jquery ui tab. The most promising thing I could find was here: Link to an anchor within JQuery tabbed content, but I haven't been able to get it to work. History is on, and I am using the "goto" parameter in the link.
The javascript I am using is as follows:
UPDATED, new jquery below. I am now navigating to the appropriate tab when clicking the link, however the page is staying in he same location instead of scrolling to the anchor
jQuery(document).ready(function($) {
$('a[goto]').click(function(evt) {
evt.preventDefault();
var whereTo = $(this).attr('goto');
$tabs = $("ul.ui-tabs-nav li");
$tabs.find('a[href=#' + whereTo + ']').trigger('click');
//alert(attr('name'));
//alert( $('#'+whereTo+' a').offset().top );
$('html, body').animate({
scrollTop: $('#'+whereTo+' a').offset().top
});
});
});
The relevant html structure is:
<div id="quicktabs-event" class="quicktabs-ui-wrapper qt-ui-tabs-processed-processed ui-tabs ui-widget ui-widget-content ui-corner-all">
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
<li class="ui-state-default ui-corner-top">
<li class="ui-state-default ui-corner-top">
<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-focus">
<a href="#qt-event-ui-tabs3" tabindex="2">Classes</a>
</li>
<li class="ui-state-default ui-corner-top">
<::after>
</ul>
<div id="qt-event-ui-tabs1" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide">
<div id="qt-event-ui-tabs2" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide">
<div id="qt-event-ui-tabs3" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
<div id="qt-event-ui-tabs4" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide">
</div>
</div>
<::after>
</div>
</div>
I appreciate any help.