1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-10-21 02:42:26 +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;
width:300px;
position:fixed;
left:-300px;
top:0;
bottom:0;
z-index:1;
@@ -684,6 +685,11 @@ textarea:-moz-placeholder {/* for FF */
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 {
margin-bottom:0.5em;
}

View File

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