1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 07:41:26 +00:00

Add side nav toggle function for small screen

This commit is contained in:
Daniel Pan
2016-04-28 16:46:46 +08:00
parent 34e5b94ab1
commit 76f479d3c9
4 changed files with 49 additions and 4 deletions

View File

@@ -28,7 +28,14 @@ define([
'can_add_repo': app.pageOptions.can_add_repo,
};
this.render();
this.$el.show();
if ($(window).width() >= 768) {
this.$el.show();
}
var _this = this;
$('#js-toggle-side-nav').click(function() {
_this.show();
return false;
});
},
render: function() {
@@ -38,7 +45,9 @@ define([
events: {
'click #group-nav a:first': 'toggleGroupList',
'click #enable-mods': 'enableMods'
'click #enable-mods': 'enableMods',
'click .js-close-side-nav': 'closeNav',
'click li > a': 'visitLink'
},
toggleGroupList: function() {
@@ -139,7 +148,26 @@ define([
error: function() {
}
});
}
},
show: function() {
this.$el.show();
},
closeNav: function() {
this.$el.hide();
return false;
},
visitLink: function(event) {
if ($(window).width() < 768) {
if ($(event.target).attr('href') !== "#") {
// except for groups toggle link
this.$el.hide();
}
}
return true;
},
});