mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 09:41:49 +08:00
Animate user card popovers
This commit is contained in:
parent
fe982aa587
commit
018eb7d062
|
@ -7,7 +7,7 @@ var precompileTemplate = Ember.Handlebars.compile;
|
|||
*/
|
||||
export default Ember.Component.extend({
|
||||
classNames: ['post-user'],
|
||||
layout: precompileTemplate('{{#if post.user}}<h3>{{#link-to "user" post.user}}{{user-avatar post.user}} {{user-name post.user}}{{/link-to}} {{ui/item-list items=post.user.badges class="badges"}}</h3>{{#if showCard}}{{user/user-card user=post.user class="user-card-popover" controlsButtonClass="btn btn-default btn-icon btn-sm btn-naked"}}{{/if}}{{else}}<h3>{{user-avatar post.user}} {{user-name post.user}}</h3>{{/if}}'),
|
||||
layout: precompileTemplate('{{#if post.user}}<h3>{{#link-to "user" post.user}}{{user-avatar post.user}} {{user-name post.user}}{{/link-to}} {{ui/item-list items=post.user.badges class="badges"}}</h3>{{#if showCard}}{{user/user-card user=post.user class="user-card-popover fade" controlsButtonClass="btn btn-default btn-icon btn-sm btn-naked"}}{{/if}}{{else}}<h3>{{user-avatar post.user}} {{user-name post.user}}</h3>{{/if}}'),
|
||||
|
||||
didInsertElement: function() {
|
||||
var component = this;
|
||||
|
@ -16,11 +16,16 @@ export default Ember.Component.extend({
|
|||
clearTimeout(timeout);
|
||||
timeout = setTimeout(function() {
|
||||
component.set('showCard', true);
|
||||
Ember.run.scheduleOnce('afterRender', function() {
|
||||
Ember.run.next(function() { component.$('.user-card').addClass('in'); });
|
||||
});
|
||||
}, 250);
|
||||
}).bind('mouseout', '> a, .user-card', function() {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(function() {
|
||||
component.set('showCard', false);
|
||||
component.$('.user-card').removeClass('in').one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function() {
|
||||
component.set('showCard', false);
|
||||
});
|
||||
}, 250);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -191,8 +191,12 @@
|
|||
& .user-card {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
margin-top: 5px;
|
||||
z-index: @zindex-popover;
|
||||
.transition(~"opacity 0.2s, margin-top 0.2s");
|
||||
|
||||
&.in {
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user