Skip to content

Commit

Permalink
fix(component): navbar & mega-mega-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
ygatesoupe committed Mar 9, 2016
1 parent dbc9eb0 commit f8445e9
Show file tree
Hide file tree
Showing 7 changed files with 505 additions and 1,242 deletions.
2 changes: 1 addition & 1 deletion docs-orange/assets/scss/_boosted-docs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
}

.bd-navbar {
font-size: 1.125rem;
font-size: 1rem;
min-height: $navbar-height;
padding: 0;

Expand Down
9 changes: 6 additions & 3 deletions docs-orange/examples/orange-news/example.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}
#header h1 {
display: inline-block;
margin-left: 20px;
/*margin-left: 20px;*/
color: #000;
vertical-align: middle;
}
Expand Down Expand Up @@ -134,8 +134,11 @@ footer a, footer span {
color: inherit;
text-align: center;
}
.mega-menu #id_for_cdu_link a {
color: #fff;
#uci_link {
margin-top: 3.6875rem !important;
color: #fff !important;
float: left;
line-height: 1;
}
.mega-menu #id_for_cdu_link a:hover,.mega-menu #id_for_cdu_link a:focus {
color: #f16e00;
Expand Down
476 changes: 116 additions & 360 deletions docs-orange/examples/orange-news/index.html

Large diffs are not rendered by default.

103 changes: 103 additions & 0 deletions docs-orange/examples/orange-news/mmenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
if(window.innerWidth < 544) {
$('.mmega-menu h3').click(function(){
var megaMenuTop = parseInt($('.mmega-menu').css('top') ,10);

if(!$(this).hasClass('folded')) {
$('.mmega-menu h2').hide();
$('.mmega-menu h3').not($(this)).hide();
$(this).next('ul').show();
$('.mmega-menu .footer').hide();
$(this).addClass('folded');
$('.mmega-menu').css('top', '50px');
} else
{
$('.mmega-menu h2').show();
$('.mmega-menu h3').not($(this)).show();
$(this).next('ul').hide();
$('.mmega-menu .footer').show();
$(this).removeClass('folded');
$('.mmega-menu').css('top', '100px');
}
});

// $('.mmega-menu h2').click(function(){
// $('header .navbar-toggler').attr('data-target', '#exCollapsingNavbar2');
// $('.mmega-menu.collapse').collapse('hide');
// $('header .navbar-toggleable-xs.collapse').collapse('show');
// });

// $('.mmega-menu.collapse').on('show.bs.collapse', function () {
// $('header .navbar-toggleable-xs.collapse').collapse('hide');
// $('header .navbar-toggler').attr('data-target', '#collapseShop');
// });

// $('.mmega-menu.collapse').on('hide.bs.collapse', function () {
// if($('header .navbar-toggler').attr('data-target') === '#collapseShop') {
// $('header .navbar-toggler').find('.icon-delete').removeClass('icon-delete').addClass('icon-menu');
// $('header .navbar-toggler').attr('data-target', '#exCollapsingNavbar2');
// }
// });

// $('header .navbar-toggleable-xs.collapse').on('shown.bs.collapse', function(){
// $('header .navbar-toggler').find('.icon-menu').removeClass('icon-menu').addClass('icon-delete');
// });

// $('header .navbar-toggleable-xs.collapse').on('hidden.bs.collapse', function(){
// if($('header .navbar-toggler').attr('data-target') === '#exCollapsingNavbar2') {
// $('header .navbar-toggler').find('.icon-delete').removeClass('icon-delete').addClass('icon-menu');
// }
// });

// include in navbar.js
$('header .navbar-toggleable-xs.collapse .nav-item a[data-toggle="collapse"]').click(function(){
var parentItem = $(this).parent();
if(!parentItem.hasClass('folded')) {
parentItem.addClass('folded');
$('header .navbar-toggleable-xs.collapse .nav-item').not(parentItem).hide();
} else {
parentItem.removeClass('folded');
$('header .navbar-toggleable-xs.collapse .nav-item').show();
}
});

// $('header .navbar-toggler').click(function(){
// if($('.mmega-menu.collapse.in')){
// $('.mmega-menu.collapse').collapse('hide');
// }
// });

// $('header .navbar-toggleable-xs.collapse').on('show.bs.collapse', function(){
// if($('header .navbar-toggleable-xs.collapse .nav-item').hasClass('folded')){
// $('.mmega-menu.collapse').collapse('show');
// }
// });

$('header .navbar-toggleable-xs.collapse').on('hide.bs.collapse', function(){
//change toggler icon
$('header .navbar-toggler').find('.icon-delete').removeClass('icon-delete').addClass('icon-menu');

//close mega-menu
if($('header .navbar-toggleable-xs.collapse .nav-item.folded a[data-toggle="collapse"]')){
$($('header .navbar-toggleable-xs.collapse .nav-item.folded a').attr('href')).collapse('hide');
}
});

$('header .navbar-toggleable-xs.collapse').on('show.bs.collapse', function(){
var megaMenuTop = parseInt($('.mmega-menu').css('top'), 10);

//change toggler icon
$('header .navbar-toggler').find('.icon-menu').removeClass('icon-menu').addClass('icon-delete');

//reset all items
$('header .navbar-toggleable-xs.collapse .nav-item').removeClass('folded');
$('header .navbar-toggleable-xs.collapse .nav-item').show();

// reset navigation
$('.mmega-menu h3').removeClass('folded');
$('.mmega-menu h2').show();
$('.mmega-menu h3').show();
$('.mmega-menu .footer').show();
$('.mmega-menu ul').hide();
$('.mmega-menu').css('top', '100px');
});
}
Loading

0 comments on commit f8445e9

Please sign in to comment.