FIX: move the user-card out of the viewport when closed

This commit is contained in:
Régis Hanol 2015-03-04 19:33:19 +01:00
parent 70931b78d9
commit 93b43c5237
1 changed files with 8 additions and 0 deletions

View File

@ -1,5 +1,7 @@
import CleansUp from 'discourse/mixins/cleans-up';
import afterTransition from 'discourse/lib/after-transition';
var clickOutsideEventName = "mousedown.outside-user-card",
clickDataExpand = "click.discourse-user-card",
clickMention = "click.discourse-user-mention";
@ -27,6 +29,12 @@ export default Discourse.View.extend(CleansUp, {
_setup: function() {
var self = this;
afterTransition(self.$(), function() {
if (!self.get('controller.visible')) {
self.$().css({ left: -9999, top: -9999 });
}
});
$('html').off(clickOutsideEventName).on(clickOutsideEventName, function(e) {
if (self.get('controller.visible')) {
var $target = $(e.target);