// fix switch menu top // side

This commit is contained in:
Kevin Granger
2013-09-11 17:26:44 +02:00
parent 739d1434b5
commit 18212420c3
3 changed files with 41 additions and 38 deletions
File diff suppressed because one or more lines are too long
@@ -356,8 +356,7 @@ html, body
text-decoration: none
&:last-child a
border-bottom: none
&.active
a
&.active a
color: contrast-color($brand-primary, white, #333, 10%)
background-color: $brand-primary
border-bottom: solid 1px darken($brand-primary,10%)
@@ -416,8 +415,8 @@ html, body
ul.submenu
display: none!important
@include box-shadow(rgba(black,0.3) 0 2px 4px)
> ul.menu > li
ul.submenu.expanded
> ul.menu > li.expanded
ul.submenu
display: block!important
> ul.menu > li
ul.submenu
@@ -446,9 +445,9 @@ html, body
&:last-child a
border-bottom: none
&.active a
color: contrast-color($main-color, white, #333, 10%)
background-color: $main-color
border-bottom: solid 1px darken($main-color,10%)
color: contrast-color($brand-primary, white, #333, 10%)
background-color: $brand-primary
border-bottom: solid 1px darken($brand-primary,10%)
.page-topbar
#main
+34 -30
View File
@@ -29,45 +29,50 @@ $( document ).ready(function() {
$('#nav-sidebar li.maintab.has_submenu').append('<span class="submenu_expand"></span>');
$('#nav-sidebar .submenu_expand').on('click',function(){
var $navId = $(this).parent();
$(".submenu-collapse").remove();
if($(".expanded").length ){
$(".expanded > ul").slideUp(
"fast",
$('.submenu-collapse').remove();
if($('.expanded').length ){
$('.expanded > ul').slideUp(
'fast',
function(){
var $target = $(".expanded");
$target.removeClass("expanded");
$($navId).not($target).not(".active").addClass("expanded");
$($navId).not($target).not(".active").children("ul:first").hide().slideDown();
var $target = $('.expanded');
$target.removeClass('expanded');
$($navId).not($target).not('.active').addClass('expanded');
$($navId).not($target).not('.active').children('ul:first').hide().slideDown();
}
);
}
else {
$($navId).not(".active").addClass("expanded");
$($navId).not(".active").children("ul:first").hide().slideDown();
$($navId).not('.active').addClass('expanded');
$($navId).not('.active').children('ul:first').hide().slideDown();
}
});
}
//nav top bar
function navTopbar(){
$("#nav-topbar").on("mouseenter", "li.maintab.has_submenu",
$('.expanded').removeClass('expanded');
$('#nav-topbar').on('mouseenter', 'li.maintab.has_submenu',
function(){
$(this).find("ul.submenu").fadeIn("fast").addClass("expanded");
$(this).addClass('expanded');
});
$("#nav-topbar").on("mouseleave", "li.maintab.has_submenu",
$('#nav-topbar').on('mouseleave', 'li.maintab.has_submenu',
function(){
$(this).find("ul.submenu").fadeOut("fast").removeClass("expanded");
$(this).removeClass('expanded');
});
$("#nav-topbar").find("li.maintab").each(
//todo hide element over menu width on load
$('#nav-topbar').find('li.maintab').each(
function(){
if ($(this).position().top > 0) {
$(this).addClass("hide");
$(this).addClass('hide');
}
});
//hide element over menu width
$(window).on("resize", function() {
$("#nav-topbar ul.menu").find("li.maintab").each(function(){
//todo hide element over menu width on resize
$(window).on('resize', function() {
$('#nav-topbar ul.menu').find('li.maintab').each(function(){
if ($(this).position().top > 0) {
$(this).addClass("hide");
$(this).addClass('hide');
}
});
});
@@ -76,30 +81,29 @@ $( document ).ready(function() {
//nav switch
function navSwitch(){
if ($("body").hasClass("page-sidebar")||$("body").hasClass("page-sidebar-closed")) {
$("body").removeClass("page-sidebar").removeClass("page-sidebar-closed").addClass("page-topbar");
$("#nav-sidebar").attr("id","nav-topbar");
$("#nav-topbar").off();
if ($('body').hasClass('page-sidebar')||$('body').hasClass('page-sidebar-closed')) {
$('body').removeClass('page-sidebar').removeClass('page-sidebar-closed').addClass('page-topbar');
$('#nav-sidebar').attr('id','nav-topbar');
$('#nav-topbar').off();
navTopbar();
} else {
$("body.page-topbar").removeClass("page-topbar").addClass("page-sidebar");
$("#nav-topbar").attr("id","nav-sidebar");
$("#nav-sidebar").off();
$('body.page-topbar').removeClass('page-topbar').addClass('page-sidebar');
$('#nav-topbar').attr('id','nav-sidebar');
$('#nav-sidebar').off();
navSidebar();
}
}
//todo add condition
navTopbar();
$("#header_shopname").on( "click",
$('#header_shopname').on('click',
function(e){
e.preventDefault();
navSwitch();
}
);
//tooltip
$('.label-tooltip').tooltip();