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

侧边栏的关闭 #947

Closed
domkat opened this Issue Jun 17, 2016 · 4 comments

Comments

Projects
None yet
5 participants
@domkat

domkat commented Jun 17, 2016

我想实现在侧边栏开启的状态下点击侧边栏之外的区域也可以关闭侧边栏,请问在哪里可以修改

@lzhr

This comment has been minimized.

lzhr commented Jun 17, 2016

应该就这些吧
sidebar

@xovel

This comment has been minimized.

xovel commented Jun 24, 2016

\source\js\src\motion.js里自行写实现该效果的js方法(当然也可以放在页面其他js文件里面):

这里贴一个实现此需求的js方法:

// $('.sidebar-inner').css({'height':'100%'});
$('body').on('click',function(e){
    var bSidebarShow = $('#sidebar').css('display')==='block' && $('#sidebar').width() > 0;
    var bFlag = $(e.target).parents('#sidebar,.sidebar-toggle').length > 0;
    if(bSidebarShow && !bFlag){
        $('.sidebar-toggle-line-wrap').trigger('click');
        e.preventDefault();
    }
});

注意:未严格测试,请慎用。

@maxchendt

This comment has been minimized.

maxchendt commented Sep 9, 2016

不错,发现在sidebar非链接区点击也可以关闭,点击目录等链接则正常导航。

@ivan-nginx

This comment has been minimized.

Collaborator

ivan-nginx commented Jul 20, 2017

@domkat dont understand u, write in English if not solved. If solved, close it please. Thank's!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment