docs: mobile view
This commit is contained in:
parent
e8f2fbbfa3
commit
a500465b54
6 changed files with 69 additions and 7 deletions
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
.codehilite {
|
||||
background: #ffffff;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.codehilite .c {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
position: fixed;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
background-color: #3c4c68;
|
||||
background-color: $osc-color;
|
||||
box-shadow: 0 2px 4px -1px rgba(0,0,0,0.25);
|
||||
}
|
||||
|
||||
|
|
|
|||
29
resources/src/scss/mobile.scss
Normal file
29
resources/src/scss/mobile.scss
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
@media (max-width:840px) {
|
||||
#menu {
|
||||
flex-direction: column;
|
||||
position: fixed;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
top: 4em;
|
||||
right: 0;
|
||||
margin: 0;
|
||||
background: $osc-color;
|
||||
border-bottom-left-radius: 3px;
|
||||
box-shadow: 0 2px 4px -1px rgba(0,0,0,0.25);
|
||||
|
||||
> * {
|
||||
flex:1;
|
||||
padding: 8px;
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
input {
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
}
|
||||
&.show {
|
||||
display: flex!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
$osc-color: #3c4c68;
|
||||
|
||||
$primary-color: rgb(75, 143, 210);
|
||||
$font-size: 0.6rem;
|
||||
@import "node_modules/spectre.css/src/spectre";
|
||||
@import "node_modules/spectre.css/src/icons";
|
||||
|
||||
@import "admonition";
|
||||
@import "codehilite";
|
||||
|
|
@ -51,6 +54,9 @@ pre, code {
|
|||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
#logo {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
#main {
|
||||
padding-top: 6.5em;
|
||||
|
|
@ -75,18 +81,21 @@ pre, code {
|
|||
line-height: 1
|
||||
}
|
||||
.col-right {
|
||||
flex: 1
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.codehilite {
|
||||
background-color: #fafafa;
|
||||
color: #37474f;
|
||||
line-height: 1em;
|
||||
max-width: 100%
|
||||
overflow-x: auto;
|
||||
border-radius: 3px;
|
||||
margin-bottom: 1.2rem;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.codehilite pre {
|
||||
padding: 12px;
|
||||
white-space: pre;
|
||||
font-feature-settings: "kern";
|
||||
font-family: $mono-font-family;
|
||||
|
|
@ -179,3 +188,5 @@ h1:first-child {
|
|||
padding:6px 12px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
@import 'mobile';
|
||||
|
|
|
|||
|
|
@ -19,10 +19,11 @@
|
|||
<div class="wrap">
|
||||
<div class="contents">
|
||||
<div class="title">
|
||||
<a href="{{ "/"|url }}"><img src="{{ "/img/logo_discourse.png"|url }}"/></a>
|
||||
<a id="logo" href="{{ "/"|url }}"><img src="{{ "/img/logo_discourse.png"|url }}"/></a>
|
||||
</div>
|
||||
<div class="header-buttons-panel">
|
||||
<span class="header-buttons">
|
||||
<button id="mobile-toggle" class="show-md btn btn-primary btn-action btn-lg"><i class="icon icon-menu"></i></button>
|
||||
<span id="menu" class="hide-md header-buttons">
|
||||
<div role="search">
|
||||
<form action="{{ "search.html"|url }}" method="get">
|
||||
<input id="mkdocs-search-query" type="search" name="q" placeholder="Search" />
|
||||
|
|
@ -112,6 +113,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script>var base_url = "{{ base_url|url }}" </script>
|
||||
<script src="{{ "/scripts.js"|url }}"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js"></script>
|
||||
<script src="{{ "search/main.js"|url }}" defer></script>
|
||||
|
|
|
|||
|
|
@ -7,3 +7,24 @@ function offsetScroll(){
|
|||
}
|
||||
window.addEventListener('hashchange', offsetScroll)
|
||||
setTimeout(offsetScroll, 250)
|
||||
|
||||
|
||||
var mobileToggle = document.getElementById('mobile-toggle'),
|
||||
mobileMenu = document.getElementById('menu'),
|
||||
show = false
|
||||
|
||||
function toggleMenu(s){
|
||||
show = s === undefined ? !show : s
|
||||
mobileToggle.classList.toggle('show', show)
|
||||
mobileMenu.classList.toggle('show', show)
|
||||
}
|
||||
|
||||
mobileToggle.addEventListener('click', function(){
|
||||
toggleMenu()
|
||||
})
|
||||
|
||||
document.addEventListener('click', function(e){
|
||||
if (!mobileToggle.parentNode.contains(e.target)) {
|
||||
toggleMenu(false)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue