Skip to content

Commit

Permalink
Menubar - get rid of hardcoded pixel values in crm.menubar.js
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw committed Jul 18, 2019
1 parent f696fd9 commit 0134c94
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions js/crm.menubar.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
}
})
.on('resize', function() {
if ($(window).width() >= 768 && $mainMenuState[0].checked) {
if (!isMobile() && $mainMenuState[0].checked) {
$mainMenuState[0].click();
}
handleResize();
Expand Down Expand Up @@ -438,13 +438,18 @@
}

function handleResize() {
if ($(window).width() >= 768 && $('#civicrm-menu').height() > 50) {
if (!isMobile() && ($('#civicrm-menu').height() >= (2 * $('#civicrm-menu > li').height()))) {
$('body').addClass('crm-menubar-wrapped');
} else {
$('body').removeClass('crm-menubar-wrapped');
}
}

// Figure out if we've hit the mobile breakpoint, based on the rule in crm-menubar.css
function isMobile() {
return $('.crm-menubar-toggle-btn', '#civicrm-menu-nav').css('top') !== '-99999px';
}

function traverse(items, itemName, op) {
var found;
_.each(items, function(item, index) {
Expand Down

0 comments on commit 0134c94

Please sign in to comment.