You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
2.0 KiB
JavaScript
100 lines
2.0 KiB
JavaScript
var listData;
|
|
//var tabData;
|
|
var htabIdx = 1;
|
|
function getListDataParent() {
|
|
var htabIndex = jQuery.jCookie('htabIndex');
|
|
if (htabIndex == "false") {
|
|
}
|
|
else {
|
|
htabIdx = parseInt(htabIndex);
|
|
if (isNaN(htabIdx)) {
|
|
htabIdx = 0;
|
|
}
|
|
}
|
|
var currentId;
|
|
$.each(tabData["list"],function(idx,item){
|
|
if(idx==htabIdx){
|
|
currentId=item.id;
|
|
}
|
|
})
|
|
//alert(currentId.toString())
|
|
return getListData(currentId.toString());
|
|
|
|
}
|
|
|
|
function getIdxParent() {
|
|
var htabIndex = jQuery.jCookie('htabIndex');
|
|
if (htabIndex == "false") {
|
|
}
|
|
else {
|
|
htabIdx = parseInt(htabIndex);
|
|
if (isNaN(htabIdx)) {
|
|
htabIdx = 0;
|
|
}
|
|
}
|
|
var currentId;
|
|
$.each(tabData["list"], function (idx, item) {
|
|
if (idx == htabIdx) {
|
|
currentId = item.id;
|
|
}
|
|
})
|
|
//alert(currentId.toString())
|
|
return currentId;
|
|
}
|
|
|
|
function createTabH(data){
|
|
//tabData=data;
|
|
//恢复上次点击的tab
|
|
|
|
var htabIndex=jQuery.jCookie('htabIndex');
|
|
if(htabIndex=="false"){
|
|
}
|
|
else{
|
|
htabIdx=parseInt(htabIndex);
|
|
if(isNaN(htabIdx)){
|
|
htabIdx=0;
|
|
}
|
|
}
|
|
|
|
var $tabContent;
|
|
$tabContent=$('<div class="htab"></div>');
|
|
$("#hbox").append($tabContent);
|
|
|
|
$.each(data["list"],function(idx,item){
|
|
var $item=$('<a href="javascript:;"><b><i></i><span></span><span class="clear"></span></b></a>');
|
|
var $itemCon=$item.find("span").eq(0);
|
|
if(item.name){
|
|
$itemCon.text(item.name);
|
|
}
|
|
if(item.className){
|
|
$item.find("i").addClass(item.className);
|
|
}
|
|
if(item.id){
|
|
$item.attr("id",item.id);
|
|
}
|
|
$tabContent.append($item);
|
|
})
|
|
|
|
$tabContent.find(">a").each(function(i){
|
|
$(this).click(function(){
|
|
$tabContent.find(">a").removeClass("current");
|
|
$(this).addClass("current");
|
|
var pid=$(this).attr("id");
|
|
changeLeftMenu(pid);
|
|
jQuery.jCookie('htabIndex',i.toString());
|
|
})
|
|
|
|
if(i==htabIdx){
|
|
//设置tab的当前选中
|
|
$(this).addClass("current");
|
|
|
|
//还原树的数据
|
|
/*
|
|
var pid=$(this).attr("id");
|
|
listData=getListData(pid);
|
|
*/
|
|
}
|
|
})
|
|
|
|
}
|