mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 11:48:08 +08:00
Use CSS animations for post and topic highlights
This commit is contained in:
@ -5,16 +5,10 @@ import { selectedText } from 'discourse/lib/utilities';
|
||||
import { observes } from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
function highlight(postNumber) {
|
||||
const $contents = $(`#post_${postNumber} .topic-body`),
|
||||
origColor = $contents.data('orig-color') || $contents.css('backgroundColor');
|
||||
const $contents = $(`#post_${postNumber} .topic-body`);
|
||||
|
||||
$contents.data("orig-color", origColor)
|
||||
.addClass('highlighted')
|
||||
.stop()
|
||||
.animate({ backgroundColor: origColor }, 2500, 'swing', function() {
|
||||
$contents.removeClass('highlighted');
|
||||
$contents.css({'background-color': ''});
|
||||
});
|
||||
$contents.addClass('highlighted');
|
||||
$contents.on('animationend', () => $contents.removeClass('highlighted'));
|
||||
}
|
||||
|
||||
export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
|
||||
|
Reference in New Issue
Block a user