Make left sidebar toggle also work with keyboard
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
This commit is contained in:
parent
a21be0ad97
commit
6d083c4de9
|
@ -1617,14 +1617,27 @@ function initCore() {
|
||||||
maxPosition: 250,
|
maxPosition: 250,
|
||||||
minDragDistance: 100
|
minDragDistance: 100
|
||||||
});
|
});
|
||||||
$('#app-content').prepend('<div id="app-navigation-toggle" class="icon-menu" style="display:none;"></div>');
|
|
||||||
$('#app-navigation-toggle').click(function(){
|
$('#app-content').prepend('<div id="app-navigation-toggle" class="icon-menu" style="display:none;" tabindex="0"></div>');
|
||||||
|
|
||||||
|
var toggleSnapperOnButton = function(){
|
||||||
if(snapper.state().state == 'left'){
|
if(snapper.state().state == 'left'){
|
||||||
snapper.close();
|
snapper.close();
|
||||||
} else {
|
} else {
|
||||||
snapper.open('left');
|
snapper.open('left');
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$('#app-navigation-toggle').click(function(){
|
||||||
|
toggleSnapperOnButton();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#app-navigation-toggle').keypress(function(e) {
|
||||||
|
if(e.which == 13) {
|
||||||
|
toggleSnapperOnButton();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// close sidebar when switching navigation entry
|
// close sidebar when switching navigation entry
|
||||||
var $appNavigation = $('#app-navigation');
|
var $appNavigation = $('#app-navigation');
|
||||||
$appNavigation.delegate('a, :button', 'click', function(event) {
|
$appNavigation.delegate('a, :button', 'click', function(event) {
|
||||||
|
|
Loading…
Reference in New Issue