add animation
This commit is contained in:
parent
25da4a6a79
commit
1edb8cf0e9
4 changed files with 54 additions and 6 deletions
22
src/client/directives/click-anime.ts
Normal file
22
src/client/directives/click-anime.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { Directive } from 'vue';
|
||||
|
||||
export default {
|
||||
mounted(el, binding, vn) {
|
||||
el.addEventListener('mousedown', () => {
|
||||
el.classList.add('_anime_bounce_ready');
|
||||
|
||||
el.addEventListener('mouseleave', () => {
|
||||
el.classList.remove('_anime_bounce_ready');
|
||||
});
|
||||
});
|
||||
|
||||
el.addEventListener('click', () => {
|
||||
el.classList.add('_anime_bounce');
|
||||
});
|
||||
|
||||
el.addEventListener('animationend', () => {
|
||||
el.classList.remove('_anime_bounce_ready');
|
||||
el.classList.remove('_anime_bounce');
|
||||
});
|
||||
}
|
||||
} as Directive;
|
||||
|
|
@ -8,6 +8,7 @@ import hotkey from './hotkey';
|
|||
import appear from './appear';
|
||||
import anim from './anim';
|
||||
import stickyContainer from './sticky-container';
|
||||
import clickAnime from './click-anime';
|
||||
|
||||
export default function(app: App) {
|
||||
app.directive('userPreview', userPreview);
|
||||
|
|
@ -18,5 +19,6 @@ export default function(app: App) {
|
|||
app.directive('hotkey', hotkey);
|
||||
app.directive('appear', appear);
|
||||
app.directive('anim', anim);
|
||||
app.directive('click-anime', clickAnime);
|
||||
app.directive('sticky-container', stickyContainer);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue