Skip to content

Commit

Permalink
Fix theme-next#812: Unable to slide sidebar on mobile browser
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Jan 15, 2020
1 parent 87e3521 commit 6a69f02
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 25 deletions.
2 changes: 2 additions & 0 deletions source/css/_common/outline/sidebar/sidebar-nav.styl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

.sidebar-panel {
display: none;
overflow-x: hidden;
overflow-y: auto;
}

.sidebar-panel-active {
Expand Down
5 changes: 0 additions & 5 deletions source/css/_common/outline/sidebar/sidebar-toc.styl
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
.post-toc-wrap {
overflow-x: hidden;
overflow-y: auto;
}

.post-toc {
font-size: $font-size-small;

Expand Down
5 changes: 0 additions & 5 deletions source/css/_common/outline/sidebar/sidebar.styl
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@
text-align: center;
}

.site-overview-wrap {
overflow-x: hidden;
overflow-y: auto;
}

.cc-license {
margin-top: 10px;
text-align: center;
Expand Down
15 changes: 0 additions & 15 deletions source/js/schemes/muse.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ window.addEventListener('DOMContentLoaded', () => {
document.querySelector('.sidebar-toggle').addEventListener('click', this.clickHandler.bind(this));
document.querySelector('.sidebar-toggle').addEventListener('mouseenter', this.mouseEnterHandler.bind(this));
document.querySelector('.sidebar-toggle').addEventListener('mouseleave', this.mouseLeaveHandler.bind(this));
this.sidebarEl.addEventListener('touchstart', this.touchstartHandler.bind(this));
this.sidebarEl.addEventListener('touchend', this.touchendHandler.bind(this));
this.sidebarEl.addEventListener('touchmove', event => event.preventDefault());
window.addEventListener('sidebar:show', this.showSidebar.bind(this));
window.addEventListener('sidebar:hide', this.hideSidebar.bind(this));
},
Expand Down Expand Up @@ -65,18 +62,6 @@ window.addEventListener('DOMContentLoaded', () => {
sidebarToggleLines.init();
}
},
touchstartHandler: function(event) {
touchPos.X = event.touches[0].clientX;
touchPos.Y = event.touches[0].clientY;
},
touchendHandler: function(event) {
var deltaX = event.changedTouches[0].clientX - touchPos.X;
var deltaY = event.changedTouches[0].clientY - touchPos.Y;
var effectiveSliding = Math.abs(deltaY) < 20 && ((deltaX > 30 && isRight) || (deltaX < -30 && !isRight));
if (this.isSidebarVisible && effectiveSliding) {
this.hideSidebar();
}
},
showSidebar: function() {
this.isSidebarVisible = true;
this.sidebarEl.classList.add('sidebar-active');
Expand Down

0 comments on commit 6a69f02

Please sign in to comment.