0
0
Fork 0

Play animated custom emoji on hover (#11348)

* Play animated custom emoji on hover in status

* Play animated custom emoji on hover in display names

* Play animated custom emoji on hover in bios/bio fields

* Add support for animation on hover on public pages emojis too

* Fix tests

* Code style cleanup
This commit is contained in:
ThibG 2019-07-21 18:10:40 +02:00 committed by Eugen Rochko
parent 043d52f785
commit 7de8c51873
7 changed files with 149 additions and 22 deletions

View file

@ -44,6 +44,12 @@ function main() {
}
};
const getEmojiAnimationHandler = (swapTo) => {
return ({ target }) => {
target.src = target.getAttribute(swapTo);
};
};
ready(() => {
const locale = document.documentElement.lang;
@ -108,6 +114,9 @@ function main() {
if (parallaxComponents.length > 0 ) {
new Rellax('.parallax', { speed: -1 });
}
delegate(document, '.custom-emoji', 'mouseover', getEmojiAnimationHandler('data-original'));
delegate(document, '.custom-emoji', 'mouseout', getEmojiAnimationHandler('data-static'));
});
delegate(document, '.webapp-btn', 'click', ({ target, button }) => {