I'm trying to make my site's menu bar better for mobile-devices.. I currently have it so it will shrink down to a little click-to-open, drop-down menu that shows my links to other pages..
My first issue I found was my menu was longer than the screen size and I couldn't scroll to show the rest of the content, so I had a look around and have now solved the issue but created another..
Whats happening is, I can open the menu just fine, choose items and scroll inside the menu as expected.. but when I click the menu button again, to hide the menu again, the links 'pull out of sight' but it leaves the background of the menu on show..
@media (max-width: 767px) {
.scroll-to-top {
display: none;
}
.show-menu {
display: block !important;
visibility: visible !important;
position: fixed;
width: 100%;
height: 300px;
z-index: 999;
overflow-y: scroll;
-webkit-transform: translate3d(0,0,0);
-webkit-overflow-scrolling: touch;
}}
I had trouble getting the scrollable menu to work but finally, I found adding the "height: xx;" part solved that issue..
I'm not very clued up about all of this stuff but try and learn from editing existing examples etc.
Can anyone see anything obvious?
[Solved]
2
(Same menu as before.)
I found this last night that I have added to my site:
@media (min-width: 768px) {.dropdown-menu li:hover .menu {visibility: visible;}}
@media (min-width: 768px) {.dropdown:hover .dropdown-menu {display: block;}}
I believe it makes my menu's click-to-display, when they would normally be hovered over when your viewing the site on a mobile-device..
I'd like to add an additional statement that sort of does the opposite, so if you were to click on an open menu, it would close again..
3
(same menu)
The way my theme I am using on my site was constructed, makes 3rd level menu items appear as a bulleted list below the 2nd level link..
I would like to change this so the 3rd level links are also, not shown as a list but rather have their own menu that drops out as well..
echo '
<div id="menu">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<div class="container">
<div class="row">
<ul class="nav navbar-nav">';
foreach ($context['menu_buttons'] as $act => $button)
{
echo '
<li id="button_', $act, '" class="', $button['active_button'] ? 'active ' : '', '', !empty($button['sub_buttons']) ? 'dropdown' : '', '">
<a ', !empty($button['sub_buttons']) ? 'class="dropdown-toggle"' : '', ' href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
', !empty($modSettings['smi_enable']) ? '<img style="vertical-align: middle;" src="'. $settings['default_images_url']. '/smi/'. $act. '.png" alt="'. $button['title']. '" title="'. $button['title']. '"/> ' : '', '', $button['title'], '', !empty($button['sub_buttons']) ? ' <span class="caret"></span>' : '' ,'
</a>';
if (!empty($button['sub_buttons']))
{
echo '
<ul class="dropdown-menu" role="menu">';
foreach ($button['sub_buttons'] as $childact => $childbutton)
{
echo '
<li>
<a href="', $childbutton['href'], '"', isset($childbutton['target']) ? ' target="' . $childbutton['target'] . '"' : '', '>
<span', isset($childbutton['is_last']) ? ' class="last"' : '', '>', !empty($modSettings['smi_enable']) ? '<img style="vertical-align: middle;" src="'. $settings['default_images_url']. '/smi/'. $childact. '.png" alt="'. $childbutton['title']. '" title="'. $childbutton['title']. '"/> ' : '', '', $childbutton['title'], !empty($childbutton['sub_buttons']) ? '...' : '', '</span>
</a>';
// 3rd level menus :)
if (!empty($childbutton['sub_buttons']))
{
echo '
<ul>';
foreach ($childbutton['sub_buttons'] as $grandchildbutton)
echo '
<li>
<a href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '>
<span', isset($grandchildbutton['is_last']) ? ' class="last"' : '', '>', $grandchildbutton['title'], '</span>
</a>
</li>';
echo '
</ul>';
}
echo '
</li>';
}
echo '
</ul>';
}
echo '
</li>';
}
echo '
</ul>
</div>
</div>
</div>
</div>';
}
Like I've mention before, I really don't have much knowledge about this stuff, but I believe the above code constructs the menu..
Any help appreciated and I can provide more code chunks / links if needed! :)
Many thanks!