Improve menu.

This commit is contained in:
Lars Jung 2014-09-01 23:23:02 +02:00
parent 1d24b7131f
commit fcecdb26e9
2 changed files with 8 additions and 0 deletions

View file

@ -4,6 +4,7 @@
## develop
* improves menu
* adds editorconfig
* updates build process, now uses [mkr](http://larsjung.de/mkr/) and [fQuery](http://larsjung.de/fquery/)
* updates `modulejs` to 1.0.0

View file

@ -7,6 +7,7 @@ modulejs.define('view/viewmode', ['_', '$', 'core/settings', 'core/resource', 'c
sizes: sizes
}, allsettings.view);
var storekey = 'viewmode';
var storekeyMenu = 'menuIsVisible';
var menuIsVisible = false;
var sidebarToggleTemplate =
'<li id="menu-toggle" class="view">' +
@ -77,7 +78,9 @@ modulejs.define('view/viewmode', ['_', '$', 'core/settings', 'core/resource', 'c
$(sidebarToggleTemplate)
.on('click', 'a', function (event) {
var menuIsVisible = store.get(storekeyMenu);
menuIsVisible = !menuIsVisible;
store.put(storekeyMenu, menuIsVisible);
$sidebar.stop().animate({
right: menuIsVisible ? 0 : -$sidebar.outerWidth()-1
});
@ -116,6 +119,10 @@ modulejs.define('view/viewmode', ['_', '$', 'core/settings', 'core/resource', 'c
update();
$sidebar.css({
right: store.get(storekeyMenu) ? 0 : -$sidebar.outerWidth()-1
});
event.sub('location.changed', adjustSpacing);
$(window).on('resize', adjustSpacing);
}