From 8aaae59b80b8a95467a5f7e7ac2383209919ae15 Mon Sep 17 00:00:00 2001 From: MinSoo Kim Date: Mon, 5 Sep 2016 17:39:14 +0900 Subject: [PATCH] Fix member menu width --- layouts/simple_world/layout.js | 24 +++++++++++++++--------- layouts/simple_world/layout.scss | 6 +++--- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/layouts/simple_world/layout.js b/layouts/simple_world/layout.js index eead87d60..e15ffe6ea 100644 --- a/layouts/simple_world/layout.js +++ b/layouts/simple_world/layout.js @@ -1,15 +1,20 @@ $(function() { - if($('.layout_menu>ul>li:first-child').width() > 50) { - $('.layout_menu>ul>li:first-child .layout_dropdown-content, .layout_menu>ul>li:first-child .layout_dropdown-content a').css('width', $('.layout_menu>ul>li:first-child').width()).css('min-width', $('.layout_menu>ul>li:first-child').width()); - } -$( window ).resize(function() { - if($('.layout_menu>ul>li:first-child').width() > 50) { - $('.layout_menu>ul>li:first-child .layout_dropdown-content, .layout_menu>ul>li:first-child .layout_dropdown-content a').css('width', $('.layout_menu>ul>li:first-child').width()).css('min-width', $('.layout_menu>ul>li:first-child').width()); - } -}); - "use strict"; + var menu_width = function() { + if($('.layout_menu>ul>li:first-child').width() > 50) { + $('.layout_menu>ul>li:first-child .layout_dropdown-content, .layout_menu>ul>li:first-child .layout_dropdown-content a').css('width', $('.layout_menu>ul>li:first-child').width()).css('min-width', $('.layout_menu>ul>li:first-child').width()); + } + } + + $( window ).resize(function() { + if($('.layout_menu>ul>li:first-child').width() > 50) { + menu_width(); + } + }); + + menu_width(); + var toggles = document.querySelectorAll(".layout_mobile_menu"); for (var i = toggles.length - 1; i >= 0; i--) { @@ -27,6 +32,7 @@ $( window ).resize(function() { obj.classList.remove("is-active"); } else { + $('.layout_menu>ul>li:first-child .layout_dropdown-content, .layout_menu>ul>li:first-child .layout_dropdown-content a').css('width', '').css('min-width', ''); var targetMenu = $(obj).attr('data-target'); $('#' + targetMenu).slideDown('300'); diff --git a/layouts/simple_world/layout.scss b/layouts/simple_world/layout.scss index d71c81bd6..f708a284b 100644 --- a/layouts/simple_world/layout.scss +++ b/layouts/simple_world/layout.scss @@ -217,8 +217,8 @@ body { text-align: center; padding: 14px 16px; text-decoration: none; - font-size: 13px; - line-height: 1; + font-size: 13px; + line-height: 1; } .layout_menu li.active>a { @@ -447,7 +447,7 @@ body { position: relative; background-color: lighten($grey, 35%); color: layoutGrayContrast(lighten($grey, 35%), 0.710); - width: 100%; + width: 100%; min-width: 100%; box-shadow: none; }