Skip to content

Commit

Permalink
fixes issue #14
Browse files Browse the repository at this point in the history
  • Loading branch information
psychobunny committed Jun 24, 2013
1 parent 4436dba commit dbf7887
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions public/src/modules/mobileMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@ define(function() {
var categories = null,
overlay = null,
menuBtn = null,
postBtn = null;
postBtn = null,
initialized = false;


function loadCategories(callback) {
if (categories) {
displayCategories();
callback(true);
return;
}

jQuery.getJSON('/api/home', function(data) {
categories = data.categories;
displayCategories();
initialized = true;

if (callback) {
callback(true);
}
});
}

Expand Down Expand Up @@ -65,6 +70,8 @@ define(function() {


mobileMenu.onNavigate = function() {
if (initialized == false) return false;

var cid = templates.get('category_id'),
tid = templates.get('topic_id');

Expand Down Expand Up @@ -100,9 +107,11 @@ define(function() {
animateIcons();
}


loadCategories(displayCategories);
mobileMenu.onNavigate();
loadCategories(function() {
displayCategories();
mobileMenu.onNavigate();
});

}

return {
Expand Down

0 comments on commit dbf7887

Please sign in to comment.