Add general _init() function. #6

This function is used to be able to call the same initialization process
for a given view every time we load that view. At the moment of
committing it's not really usable, but it can solve some issues later.
This commit is contained in:
Arpad Csanyi
2016-03-17 00:23:21 +01:00
parent 3a4b83f51c
commit 335f7be207

11
app.js
View File

@@ -3,6 +3,7 @@ $(function() {
var sidebarMenuSource = $('#sidebar-menu--source').html();
var sidebarMenuTemplate = Handlebars.compile(sidebarMenuSource);
$('#sidebar-menu').html(sidebarMenuTemplate(menuObject));
_init('.keymap--edit');
// =======================
// Menu-item functionality
@@ -33,6 +34,7 @@ $(function() {
// Change .active class in the sidebar.
$('.sidebar__level-2--item.active').removeClass('active');
_this.addClass('active');
_init(dataContent);
});
// ========================
@@ -59,6 +61,15 @@ $(function() {
});
function _init(view) {
switch (view) {
case '.keymap--edit':
var h = $('.uhk--base-layer').height();
$('.keyboard-slider').height(h + 'px');
break;
}
}
var menuObject = {
menu: [
{