Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix menu width and submenu hover on header #8846

Merged
merged 2 commits into from Mar 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions themes/classic/_dev/css/components/mainmenu.scss
Expand Up @@ -58,6 +58,20 @@
margin-top: 0;
}

#_desktop_top_menu {
.top-menu {
&[data-depth="0"] {
li {
&:hover {
.sub-menu {
display: block !important;
}
}
}
}
}
}

#mobile_top_menu_wrapper {
margin-top: 0.625rem;
padding-bottom: 0.625rem;
Expand Down
13 changes: 8 additions & 5 deletions themes/classic/_dev/css/theme.scss
Expand Up @@ -41,6 +41,14 @@
color: $brand-primary;
}
}
.menu {
display: inline-block;
> ul {
> li {
display: inline-block;
}
}
}
.header-nav {
border-bottom: $gray-light 2px solid;
max-height: 50px;
Expand Down Expand Up @@ -129,11 +137,6 @@
}
padding-bottom: 1.25rem;
.menu {
> ul {
> li {
float: left;
}
}
padding-left: 15px;
margin-bottom: 0.375rem;
}
Expand Down
5 changes: 2 additions & 3 deletions themes/classic/_dev/js/components/top-menu.js
Expand Up @@ -40,7 +40,7 @@ export default class TopMenu extends DropDown {
elmId = $(e.currentTarget).attr('id');
}
if (elmId && $(e.target).data('depth') === 0) {
$(`#${elmId} .js-sub-menu`).show().css({
$(`#${elmId} .js-sub-menu`).css({
top: $(`#${elmId}`).height() + $(`#${elmId}`).position().top
});
}
Expand All @@ -49,11 +49,10 @@ export default class TopMenu extends DropDown {
$('#mobile_top_menu_wrapper').toggle();
self.toggleMobileMenu();
});
$('.js-top-menu').mouseleave(() => {
$('.js-top-menu .category').mouseleave(() => {
if (this.el.parent().hasClass('mobile')) {
return;
}
$(`#${elmId} .js-sub-menu`).hide();
});
this.el.on('click', (e) => {
if (this.el.parent().hasClass('mobile')) {
Expand Down
2 changes: 1 addition & 1 deletion themes/classic/assets/css/theme.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion themes/classic/assets/js/theme.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion themes/classic/modules/ps_mainmenu/ps_mainmenu.tpl
Expand Up @@ -33,7 +33,7 @@
{/if}
{/function}

<div class="menu col-lg-8 col-md-7 js-top-menu position-static hidden-sm-down" id="_desktop_top_menu">
<div class="menu js-top-menu position-static hidden-sm-down" id="_desktop_top_menu">
{menu nodes=$menu.children}
<div class="clearfix"></div>
</div>