feat: aside 可配置隐藏/增加按钮可展开或收缩aside

This commit is contained in:
Jerry 2020-10-21 21:54:14 +08:00
parent c54f23bc14
commit 6b35388f33
8 changed files with 30 additions and 3 deletions

View File

@ -600,6 +600,8 @@ preloader: false
aside:
enable: true
hide: false
button: true
mobile: true # display on mobile
position: right # left or right
card_author:

View File

@ -1,7 +1,8 @@
- var htmlClassHideAside = theme.aside.enable && theme.aside.hide ? 'hide-aside' : ''
- var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : ''
doctype html
html(lang=config.language data-theme=theme.display_mode)
html(lang=config.language data-theme=theme.display_mode class=htmlClassHideAside)
head
include ./head.pug
body

View File

@ -23,6 +23,10 @@
button#rightside_config(type="button" title=_p("rightside.setting"))
i.fas.fa-cog
if theme.aside.enable && theme.aside.button
button#hide-aside-btn(type="button")
i.fas.fa-arrows-alt-h
if theme.chat_btn
button#chat_btn(type="button" title=_p("rightside.chat_btn"))
i.fas.fa-sms

View File

@ -1,6 +1,6 @@
{
"name": "hexo-theme-butterfly",
"version": "3.3.0-b5",
"version": "3.3.0-b6",
"description": "A Simple and Card UI Design theme for Hexo",
"main": "package.json",
"scripts": {

View File

@ -327,3 +327,14 @@
100%
transform: scale(.7)
+minWidth900()
html.hide-aside
.layout
justify-content: center
> div:last-child
display: none
> div:first-child
width: 80%

View File

@ -38,3 +38,7 @@
+maxWidth900()
display: block
+maxWidth900()
#hide-aside-btn
display: none

View File

@ -19,7 +19,6 @@
border-radius: 8px
background: var(--card-bg)
box-shadow: 0 4px 8px 6px rgba(7, 17, 27, .06)
transition: all .3s
&:hover
box-shadow: 0 4px 12px 12px rgba(7, 17, 27, .15)
@ -29,6 +28,7 @@
& > div:first-child
width: 75%
transition: all .3s
+maxWidth900()
width: 100% !important

View File

@ -483,6 +483,11 @@ $(function () {
// Back to top
$rightsideEle.on('click', '#go-up', () => btf.scrollToDest('body'))
$rightsideEle.on('click', '#hide-aside-btn', () => {
const $htmlDom = $(document.documentElement)
$htmlDom.hasClass('hide-aside') ? $htmlDom.removeClass('hide-aside') : $htmlDom.addClass('hide-aside')
})
/**
* menu
* 側邊欄sub-menu 展開/收縮