56 lines
1.7 KiB
JavaScript
56 lines
1.7 KiB
JavaScript
// TOPBAR NAV
|
|
var universTab = false;
|
|
|
|
$(document).ready( function() {
|
|
// TOPBAR NAV
|
|
universTab = $("div.topbar > ul.inline-menu > li");
|
|
if(universTab.length>0) initTopBarNav();
|
|
|
|
// ALERT DISMISS
|
|
$("div.alert-dismissable > button.close").click(function(e) {
|
|
e.preventDefault();
|
|
$(this).parent().remove();
|
|
})
|
|
});
|
|
|
|
// TOPBAR NAV
|
|
|
|
function initTopBarNav() {
|
|
$("div.topbar > ul.inline-menu > li[univers=home]").click(function(e) {
|
|
e.preventDefault();
|
|
document.location = "index.php?page=home&subpage=home";
|
|
});
|
|
|
|
universTab.find("li").click(function(e) {
|
|
e.preventDefault();
|
|
document.location = "index.php?page=" + $(this).attr('univers') + "&subpage=" + $(this).attr('category');
|
|
});
|
|
|
|
universTab.each(function(n,e) {
|
|
w = $(this).outerWidth();
|
|
sw = $(this).find("ul.submenu > li").outerWidth();
|
|
|
|
if(sw<w) $(this).find("ul.submenu > li").css("width", (w-23)+"px");
|
|
});
|
|
|
|
$("div.topbar > ul.inline-menu > li[univers=search]").click(function(e) {
|
|
e.preventDefault();
|
|
document.location = "index.php?page=search";
|
|
});
|
|
|
|
$("#btnCollapseMenu").click(function(e) {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
var topBarMenu = $("div.topbar > ul.inline-menu");
|
|
if(topBarMenu.hasClass("unfold")) topBarMenu.removeClass("unfold").removeAttr("style");
|
|
else {
|
|
mh = $(window).height() - 100;
|
|
topBarMenu.addClass("unfold").css("max-height", mh+"px");
|
|
}
|
|
})
|
|
|
|
$(body).click(function(e) {
|
|
var topBarMenu = $("div.topbar > ul.inline-menu");
|
|
if(topBarMenu.hasClass("unfold")) topBarMenu.removeClass("unfold").removeAttr("style");
|
|
})
|
|
} |