6

Adding a submenu for Forums item with a list of categories (Web portal)

For fast forum navigation you can add a dropdown submenu for Forums item. Submenu will contain a list of categories.

To do it add next script to Global Javascript  widget.

 

var menu_html='<ul class="menu-drop"></ul>';
$j('li.tab_forums').append(menu_html);

var s_zurl = "/api/v2/categories.json";

new Ajax.Request(s_zurl,
{
method:'GET',asynchronous: true,onSuccess: function(transport)
{
var obj = transport.responseText.evalJSON();
$j.each(obj.categories, function () {
var id=this.id;
var name = this.name;
$j('li.tab_forums ul.menu-drop').append('<li data-menu-item-name="cat\_'+id+'"><a href="/categories/'+id+'">'+name+'</a></li>');
});
}
});

8 comments

Please sign in to leave a comment.