Tab select problem when user navigate away and then come back
I implemented the Jquery UI Tabs & RSH. They work perfectly when users
do in page navigation. The history is remembered and URL also changed
accordingly..
For example, for the third tab, the URL is like: http://www.XXX.com/shopping/rateplan.page?#2
The problem, when user navigate away, click browser "back" button to
come back, the URL is correct. but it always show me the previous tab,
not the tab on which user is browsing before they leave,
I use following code to select tab:
<script type="text/javascript">
// <![CDATA[
$(document).ready(function() {
var start =
window.location.href.lastIndexOf("#");
var tabIndex = 0;
if ( start !== -1 )
tabIndex =
window.location.href.substring(start+1, start + 2 ) ;
$(".wirelessPlansTabs .tabs").tabs();
$(".wirelessPlansTabs > .tabs").tabs
('select', tabIndex);
})
// ]]>
</script>
For the URL http://www.XXX.com/shopping/rateplan.page?#2, And I used
alert to print out the value of tabIndex, it is 2. I do not why it
always show me the second tab, not the third.
Any idea?
Thanks in advance