ability to make links to inner tabs

This commit is contained in:
Sanj 2012-01-04 20:44:07 +05:30
parent b1d5b27913
commit 9bf67e67b5
2 changed files with 22 additions and 19 deletions

View File

@ -1,3 +1,5 @@
var queryData;
$('#listLeft ul li a').live("click", function() {
if ($(this).hasClass("listLeftSelected")) {
return false;
@ -282,7 +284,7 @@ $(function() {
// console.log(State);
var queryData = QueryStringToJSON(State.hash);
queryData = QueryStringToJSON(State.hash);
doState(queryData);

View File

@ -159,30 +159,31 @@
</div>
<script type="text/javascript">
$(document).ready(function() {
//When page loads...
$(".tab_content").hide(); //Hide all content
$("ul.tabsInnerRight li:first").addClass("active").show(); //Activate first tab
var State = History.getState();
// console.log(State);
var queryData = QueryStringToJSON(State.hash); //FIXME: ideally this would go into global doState function
if (queryData.hasOwnProperty("innertab")) {
if ($('#' + queryData.innerTab).length > 0) {
$('#' + queryData.innerTab).show();
} else {
$('.tab_content:first').show();
}
} else {
$(".tab_content:first").show(); //Show first tab content
}
// $("ul.tabsInnerRight li:first").addClass("active").show(); //Activate first tab
//On Click Event
$("ul.tabsInnerRight li").click(function() {
$("ul.tabsInnerRight li").removeClass("active"); //Remove any "active" class
$(".active").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active ID content
return false;
});
});
// var queryData = {};
if (queryData.hasOwnProperty("innertab")) {
if ($('#' + queryData.innertab).length > 0) {
$('a[href=#' + queryData.innertab + "]").click();
} else {
$('ul.tabsInnerRight li:first').click();
}
} else {
$('ul.tabsInnerRight li:first').click(); //Show first tab content
}
</script>