Hotfix/remove search hamburger (#125)

* Removed hamburger and inserted close button in sidebar

* Replace sidebar mobile slide out with fade in

* Updated mobile menu button to translate into different languages
This commit is contained in:
Jared Lee 2016-11-04 16:51:02 +13:00 committed by Cam Findlay
parent b8dea84832
commit 55867c7845
7 changed files with 119 additions and 111 deletions

View File

@ -49,7 +49,7 @@ html {
/*! sidebar */
#sidebar {
float: left;
padding-top:24px;
padding-top:20px;
}
#sidebar .nav,
@ -97,6 +97,9 @@ html {
background-color: #1389ce;
color: #fff;
text-decoration: none;
-webkit-transition: all 500ms ease;
-moz-transition: all 500ms ease;
transition: all 500ms ease;
}
#sidebar .nav .section .top {
@ -557,7 +560,7 @@ html {
color:#696868;
}
.menu-toggle {
.menu-open {
display:none;
}
@ -683,6 +686,10 @@ html {
#sidebar {
width: 25%;
}
/* Removes close button on desktop view */
#sidebar .menu-close {
display: none;
}
.documentation_children li {
width:33%;
@ -694,19 +701,44 @@ html {
width: 1170px;
}
}
/* Sidebar mobile styles (default:hidden) */
@media (max-width: 991px) {
#sidebar {
width: 265px;
position: fixed;
background: #fff;
left: -300px;
bottom: 0;
background: transparent;
top: 0;
z-index: 9999;
box-shadow: -2px 1px 40px -3px #999;
overflow-y:auto;
overflow-x:hidden;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
z-index: -1; /* [-1] Sidebar: hidden, [0] Page, [1] Sidebar: Show */
box-shadow: none;
overflow-x: hidden;
overflow-y: auto;
-webkit-transition: all 300ms ease;
-moz-transition: all 300ms ease;
transition: all 300ms ease;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-moz-box-shadow: none!important;
-webkit-box-shadow: none!important;
box-shadow: none!important;
}
/* Opened sidebar styles */
#sidebar.open {
z-index: 1;
background: #fff;
opacity: 1;
}
/* Fade out sidebar state styles before class is removed */
#sidebar.hide {
z-index: 1;
background: transparent;
color: white;
}
#content {
@ -726,81 +758,56 @@ html {
font-size:14px;
}
.wrapper .menu-toggle {
/* Menu button styles */
.wrapper .menu-open {
display: block;
position: relative;
width: 70px;
height: 40px;
margin-left: auto;
margin-bottom: 20px;
padding: 7px 10px;
font-weight: 700;
text-decoration: none;
text-transform: uppercase;
color: #1389ce;
background-color: transparent;
border: 2px solid #1389ce;
border-radius: 5px;
cursor: pointer;
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
}
.wrapper .menu-open:hover {
background-color: #1389ce;
color: #fff;
transition: 300ms 0.1s ease;
}
/* Close button styles */
.menu-close {
display: block;
position: relative;
margin-left: auto;
margin-bottom: 20px;
width: 30px;
height: 39px;
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
-webkit-transition: .5s ease-in-out;
-moz-transition: .5s ease-in-out;
-o-transition: .5s ease-in-out;
transition: .5s ease-in-out;
margin-right: 10px;
padding: 0px 12px;
font-size: 33px;
font-weight: 700;
line-height: 33px;
text-decoration: none;
color: #1389ce;
width: 40px;
height: 40px;
cursor: pointer;
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
}
.menu-toggle span {
display: block;
position: absolute;
height: 3px;
width: 100%;
background: #1389ce;
border-radius: 9px;
left: 0;
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
-webkit-transition: .25s ease-in-out;
-moz-transition: .25s ease-in-out;
-o-transition: .25s ease-in-out;
transition: .25s ease-in-out;
}
/* Hamburger line positioning */
.menu-toggle span:nth-child(1) {
top: 8px;
}
.menu-toggle span:nth-child(2),
.menu-toggle span:nth-child(3) {
top: 18px;
}
.menu-toggle span:nth-child(4) {
top: 28px;
}
/* X line Animation */
.menu-toggle.open span:nth-child(1) {
top: 18px;
width: 0%;
left: 50%;
}
.menu-toggle.open span:nth-child(2) {
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
.menu-toggle.open span:nth-child(3) {
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.menu-toggle.open span:nth-child(4) {
top: 18px;
width: 0%;
left: 50%;
.menu-close:hover {
text-decoration: none;
}
}

View File

@ -1,15 +1,26 @@
;(function($) {
$(document).ready(function() {
//toggle the side menu when in mobile
$('.menu-toggle').on('click', function (e) {
e.preventDefault();
var left = $('#sidebar').is('.visible') ? -270 : 0;
$('#sidebar').animate({ left: left}, 'fast', function() {
$(this).toggleClass('visible');
});
$(this).toggleClass('open');
})
// Open sidebar on mobile
$('.menu-open').click(function(){
$('#sidebar').removeClass('hide').addClass('open');
return false;
});
// Close sidebar on mobile
$('.menu-close').click(function(){
$('#sidebar').removeClass('open').addClass('hide');
setTimeout(function() {
$('#sidebar').removeClass('hide');
}, 500);
return false;
});
// Close sidebar by hitting of ESC
$(document).keyup(function(e) {
if (e.keyCode == 27) {
$('#sidebar').removeClass('open');
}
});
var switched = false;

View File

@ -6,6 +6,7 @@ en:
CHANGE: Change
KEYWORDS: Keywords
LANGUAGE: Language
MENU: Menu
MODULES: Modules
OPENSEARCHDESC: 'Search the documentation'
OPENSEARCHNAME: 'Documentation Search'

View File

@ -5,12 +5,12 @@
<div id="masthead" <% if Versions %>class="has_versions"<% end_if %>>
<div class="wrapper">
<a class="menu-toggle">
<span></span>
<span></span>
<span></span>
<span></span>
</a>
<div class="menu-bar">
<a class="logo" href="https://userhelp.silverstripe.org/"></a>
<a class="menu-open">
<%t DocumentationViewer.MENU "Menu" %>
</a>
</div>
<% if Breadcrumbs.count > 1 %>
<% include DocumentationBreadcrumbs %>

View File

@ -8,15 +8,9 @@
<div class="doc-breadcrumbs">
<p>
<a class="menu-toggle">
<span></span>
<span></span>
<span></span>
<span></span>
</a>
<a class="breadcrumb" href="$BaseHref">Documentation</a>
<span>/</span>
<a class="breadcrumb current">Index</a>
<a class="breadcrumb" href="$BaseHref">Documentation</a>
<span>/</span>
<a class="breadcrumb current">Index</a>
</p>
</div>

View File

@ -8,12 +8,6 @@
<div class="doc-breadcrumbs">
<p>
<a class="menu-toggle">
<span></span>
<span></span>
<span></span>
<span></span>
</a>
<a class="breadcrumb" href="$BaseHref">Documentation</a>
<span>/</span>
<a class="breadcrumb current">Search</a>

View File

@ -1,4 +1,5 @@
<div id="sidebar">
<a class="menu-close" href="#">×</a>
<div class="box">
$DocumentationSearchForm
<ul class="nav">