1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-12 21:30:39 +00:00

[side nav] improvement

This commit is contained in:
llj
2016-05-18 14:48:23 +08:00
parent 702077bd0e
commit d15fb971f9
2 changed files with 23 additions and 5 deletions

View File

@@ -747,14 +747,15 @@ textarea:-moz-placeholder {/* for FF */
transition: all 0.3s ease; transition: all 0.3s ease;
} }
.home-side-nav { .home-side-nav {
display:flex;
flex-direction:column;
padding:0; padding:0;
} }
.home-side-nav:hover {
overflow:hidden;
}
.side-nav-con { .side-nav-con {
overflow:hidden; overflow:hidden;
padding:20px; padding:20px;
flex-grow:1; height:calc(100% - 50px);
} }
.side-nav-con:hover { .side-nav-con:hover {
overflow-y:auto; overflow-y:auto;

View File

@@ -115,12 +115,25 @@ define([
}, },
setCurTab: function(cur_tab, options) { setCurTab: function(cur_tab, options) {
if (this.$curTab) {
this.$('.tab-cur').removeClass('tab-cur');
this.$curTab.addClass('tab-cur');
return;
}
this.data.cur_tab = cur_tab || this.default_cur_tab; this.data.cur_tab = cur_tab || this.default_cur_tab;
if (options) { if (options) {
$.extend(this.data, options); $.extend(this.data, options);
} }
this.data.show_group_list = $('#group-nav .grp-list:visible').length ? true : false; this.data.show_group_list = $('#group-nav .grp-list:visible').length ? true : false;
this.render(); this.render();
var curTabTop = this.$('.tab-cur').offset().top;
var visibleHeight = $(window).height() - this.$('.side-nav-footer').outerHeight(true);
if (curTabTop > visibleHeight) {
this.$('.side-nav-con').css({'overflow':'auto'}).scrollTop(curTabTop - visibleHeight + this.$('.tab-cur').outerHeight(true) + 10).removeAttr('style');
}
}, },
updateGroups: function() { updateGroups: function() {
@@ -166,9 +179,13 @@ define([
return false; return false;
}, },
visitLink: function(event) { visitLink: function(e) {
if ($(e.target).attr('href') !== "#") {
this.$curTab = $(e.target).parent();
}
if ($(window).width() < 768) { if ($(window).width() < 768) {
if ($(event.target).attr('href') !== "#") { if ($(e.target).attr('href') !== "#") {
// except for groups toggle link // except for groups toggle link
this.hide(); this.hide();
} }