Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close sidebar when click any blank part #606

Closed
5 of 11 tasks
roastduckcd opened this issue Feb 14, 2019 · 2 comments · Fixed by #607
Closed
5 of 11 tasks

Close sidebar when click any blank part #606

roastduckcd opened this issue Feb 14, 2019 · 2 comments · Fixed by #607

Comments

@roastduckcd
Copy link

roastduckcd commented Feb 14, 2019

I agree and want to create new issue


Expected behavior

can it possible to add a new feature about closing sidebar while click blank area?

Actual behavior

right now, it can only be done by clicking the "sidebar-toggle" button at the lower right.

Hexo Information

Hexo version

hexo: 3.8.0
hexo-cli: 1.1.0
os: Darwin 18.2.0 darwin x64
node: 11.7.0

NexT Information

NexT Version:

  • Latest Master branch
  • Latest Release version
  • Old version

NexT Scheme:

  • All schemes
  • Muse
  • Mist
  • Pisces
  • Gemini
@stevenjoezhang
Copy link
Contributor

stevenjoezhang commented Feb 15, 2019

Clicking the "sidebar-toggle" button is not the only way to close the sidebar. It can be done by swiping over the screen:

touchendHandler: function(e) {
var _xPos = e.originalEvent.changedTouches[0].clientX;
var _yPos = e.originalEvent.changedTouches[0].clientY;
if (_xPos - xPos > 30 && Math.abs(_yPos - yPos) < 20) {
this.clickHandler();
}
},

Also, the feature to close sidebar when click blank area is already enabled on mobile platform:
iissnan/hexo-theme-next@3a3b864
See:
this.toggleEl.on('click', this.clickHandler.bind(this));
this.dimmerEl.on('click', this.clickHandler.bind(this));
this.toggleEl.on('mouseenter', this.mouseEnterHandler.bind(this));
this.toggleEl.on('mouseleave', this.mouseLeaveHandler.bind(this));
this.sidebarEl.on('touchstart', this.touchstartHandler.bind(this));
this.sidebarEl.on('touchend', this.touchendHandler.bind(this));
this.sidebarEl.on('touchmove', function(e) { e.preventDefault(); });

@stevenjoezhang
Copy link
Contributor

Fixed in #607

@ivan-nginx ivan-nginx changed the title close sidebar when click any blank part Close sidebar when click any blank part [solved] Mar 4, 2019
tongluyang pushed a commit to tongluyang/hexo-theme-next that referenced this issue Nov 19, 2019
@stevenjoezhang stevenjoezhang changed the title Close sidebar when click any blank part [solved] Close sidebar when click any blank part Mar 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants