fix sticky header not working

This commit is contained in:
Matteo Pagliazzi
2016-06-07 21:12:31 +02:00
parent e1b8d52a27
commit 5e01b3d129
3 changed files with 8 additions and 6 deletions

View File

@@ -18,7 +18,7 @@
padding: 0 // remove padding when toolbar is hidden
.sticky-wrapper
height: 215px !important
height: 215px
/* login/menu buttons
--------------------- */

View File

@@ -8,9 +8,12 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
var user = User.user;
var initSticky = _.once(function(){
if (window.env.IS_MOBILE || User.user.preferences.stickyHeader === false) return;
$('.header-wrap').sticky({topSpacing:0});
})
$timeout(function () {
if (window.env.IS_MOBILE || User.user.preferences.stickyHeader === false) return;
$('.header-wrap').sticky({topSpacing:0});
});
});
$rootScope.$on('userUpdated',initSticky);
$rootScope.$on('$stateChangeSuccess',

View File

@@ -80,8 +80,6 @@ angular.module('habitrpg')
_.extend(user, response.data.data);
$rootScope.$emit('userUpdated', user);
if (!user._wrapped) {
// This wraps user with `ops`, which are functions shared both on client and mobile. When performed on client,
// they update the user in the browser and then send the request to the server, where the same operation is
@@ -106,6 +104,7 @@ angular.module('habitrpg')
syncUserTasks(tasks);
$rootScope.$emit('userSynced');
$rootScope.appLoaded = true;
$rootScope.$emit('userUpdated', user);
});
}