/**
|
*
|
*/
|
var basic=getpath();
|
jQuery(document).ready(function($) {
|
metromenus()
|
});
|
|
function metromenus(){
|
var path=window.document.location.pathname;
|
jQuery.post(basic+'/admin/bmenucon/ftmenu.htm', {title:'lftmenus'}, function(data, textStatus, xhr) {
|
if(data==null)
|
return;
|
var navlist=$('ul#menuulroot');
|
var startflg=false;
|
var li_parent=null;
|
var ul_child=null;
|
var li_child=null;
|
var li_parent_lft=0;
|
var li_parent_rgt=0;
|
jQuery.each(data, function(index, val) {
|
var lft=val.lft;
|
var rgt=val.rgt;
|
if(lft<li_parent_rgt)
|
{
|
li_child=jQuery('<li> <a href="'+val.url+'">'+val.title+' </a> </li>').appendTo(ul_child);
|
}else{
|
li_parent=jQuery('<li></li>').appendTo(navlist);
|
if(startflg==false)
|
{
|
li_parent.addClass('start');
|
startflg=true;
|
}
|
ul_child=null;
|
var a=jQuery('<a href="javascript:void(0);" class="dropdown-toggle"></a>').appendTo(li_parent);
|
var i=jQuery('<i class="'+val.icon+'"></i>').appendTo(a);
|
var span=jQuery('<span class="menu-text">'+val.title+'</span>').appendTo(a);
|
var b=jQuery('<b class="arrow icon-angle-down"></b>').appendTo(a);
|
li_parent_lft=lft;
|
li_parent_rgt=rgt;
|
if(rgt-lft>1)
|
{
|
ul_child=jQuery('<ul class="sub-menu"></ul>').appendTo(li_parent);
|
}else{
|
a.removeClass('dropdown-toggle');
|
if(val.url!=null&&val.url!='')
|
{
|
a.attr('href',val.url);
|
}
|
}
|
}
|
if(val.url!=null&&val.url.indexOf(path)>=0)
|
{
|
li_parent.addClass('active');
|
li_parent.addClass('open');
|
if(li_child!=null)
|
li_child.addClass('active');
|
}
|
});
|
},'json');
|
}
|