[jQuery] Tabs and scrollTo()
Ok... Getting close here...
I have a structure of scrollable divs in ajax ui.tabs
<div style="overflow:scroll" id="day1">
...
</div>
<div style="overflow:scroll" id="day2">
<a name="first2"></a>
</div>
<div style="overflow:scroll" id="day3">
<a name="first3"></a>
</div>
<div style="overflow:scroll" id="day4">
...
</div>
...
Now, I have it set up to scroll to the top of each div:
$().ready(function() {
$('#tabs > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle' },
load: function () { $('#dialog').jqmAddTrigger('a.details',this) },
show: function () {
for( var i=1; i<=7; i++ )
if( $("#day"+i).length && $("a[name=first"+i+"]").length )
$("#day"+i).scrollTo( $("a[name=first"+i+"]"), 0 );
}
});
$('#dialog').jqm({ ajax: '@href' });
});
Moving the scrollTo() into "show" helped it at least scroll but the problem
I am running into is that scrollTo() always skips "first2" and will scroll
"first3". I can't figure out why. Any ideas?
Also, is there a good way to simplify the for loop with a .each() function?
Thanks
Steffan
---------------------------------------------------------------
T E L 6 0 2 . 7 9 3 . 0 0 1 4 | F A X 6 0 2 . 9 7 1 . 1 6 9 4
Steffan A. Cline
Steffan@ExecuChoice.net Phoenix, Az
http://www.ExecuChoice.net USA
AIM : SteffanC ICQ : 57234309
YAHOO : Steffan_Cline MSN : steffan@hldns.com
GOOGLE: Steffan.Cline Lasso Partner Alliance Member
---------------------------------------------------------------