FIX: move the user-card out of the viewport when closed
This commit is contained in:
parent
70931b78d9
commit
93b43c5237
|
@ -1,5 +1,7 @@
|
||||||
import CleansUp from 'discourse/mixins/cleans-up';
|
import CleansUp from 'discourse/mixins/cleans-up';
|
||||||
|
|
||||||
|
import afterTransition from 'discourse/lib/after-transition';
|
||||||
|
|
||||||
var clickOutsideEventName = "mousedown.outside-user-card",
|
var clickOutsideEventName = "mousedown.outside-user-card",
|
||||||
clickDataExpand = "click.discourse-user-card",
|
clickDataExpand = "click.discourse-user-card",
|
||||||
clickMention = "click.discourse-user-mention";
|
clickMention = "click.discourse-user-mention";
|
||||||
|
@ -27,6 +29,12 @@ export default Discourse.View.extend(CleansUp, {
|
||||||
_setup: function() {
|
_setup: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
afterTransition(self.$(), function() {
|
||||||
|
if (!self.get('controller.visible')) {
|
||||||
|
self.$().css({ left: -9999, top: -9999 });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$('html').off(clickOutsideEventName).on(clickOutsideEventName, function(e) {
|
$('html').off(clickOutsideEventName).on(clickOutsideEventName, function(e) {
|
||||||
if (self.get('controller.visible')) {
|
if (self.get('controller.visible')) {
|
||||||
var $target = $(e.target);
|
var $target = $(e.target);
|
||||||
|
|
Loading…
Reference in New Issue