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

Improve side nav show/hide on window resize

This commit is contained in:
Daniel Pan
2016-05-04 21:31:12 +08:00
parent 374edec89b
commit 34e5709c16
2 changed files with 19 additions and 6 deletions

View File

@@ -675,6 +675,7 @@ textarea:-moz-placeholder {/* for FF */
background: #f8f8f8; background: #f8f8f8;
width:300px; width:300px;
position:fixed; position:fixed;
left:-300px;
top:0; top:0;
bottom:0; bottom:0;
z-index:1; z-index:1;
@@ -684,6 +685,11 @@ textarea:-moz-placeholder {/* for FF */
border-right:1px solid #eee; border-right:1px solid #eee;
} }
} }
.side-tabnav {
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
transition: all 0.3s ease;
}
.side-tabnav .hd { .side-tabnav .hd {
margin-bottom:0.5em; margin-bottom:0.5em;
} }

View File

@@ -28,14 +28,17 @@ define([
'can_add_repo': app.pageOptions.can_add_repo, 'can_add_repo': app.pageOptions.can_add_repo,
}; };
this.render(); this.render();
if ($(window).width() >= 768) {
this.$el.show(); this.$el.show();
}
var _this = this; var _this = this;
$('#js-toggle-side-nav').click(function() { $('#js-toggle-side-nav').click(function() {
_this.show(); _this.show();
return false; return false;
}); });
$(window).resize(function() {
if ($(window).width() >= 768) {
_this.show();
}
});
}, },
render: function() { render: function() {
@@ -151,11 +154,15 @@ define([
}, },
show: function() { show: function() {
this.$el.show(); this.$el.css({ 'left':'0px' });
},
hide: function() {
this.$el.css({ 'left':'-300px' });
}, },
closeNav: function() { closeNav: function() {
this.$el.hide(); this.hide();
return false; return false;
}, },
@@ -163,7 +170,7 @@ define([
if ($(window).width() < 768) { if ($(window).width() < 768) {
if ($(event.target).attr('href') !== "#") { if ($(event.target).attr('href') !== "#") {
// except for groups toggle link // except for groups toggle link
this.$el.hide(); this.hide();
} }
} }
return true; return true;