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:
11
app.js
11
app.js
@@ -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: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user