Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding of fade effect to angular2-flash-messages #23

Open
darsana opened this issue Jun 29, 2017 · 4 comments
Open

Adding of fade effect to angular2-flash-messages #23

darsana opened this issue Jun 29, 2017 · 4 comments

Comments

@darsana
Copy link

darsana commented Jun 29, 2017

Hi...

currentley i am using the flash message like below
this._flashMessagesService.show('Added Successfully!', { cssClass: 'alert-success', timeout: 1900 });
How an i add the fade effect to the message ?

@moff
Copy link
Owner

moff commented Jun 29, 2017

Hi @darsana!
There is no such functionality in the package.

@seantrant
Copy link

Hi @darsana,

Bit late, but it might still help you or someone else who wants to do this. You can get this effect with css.

Create a css rule with keyframes that will fade in and out over a time period.

@Keyframes flashfade {
0% {opacity:0;}
20% {opacity:1}
80% {opacity:1}
100% {opacity:0}
}
.flashfade {
animation-name: flashfade;
animation-duration: 6s;
display: block;
}

Then just include this class when calling the function, and set the effect to last as long as the css animation.

this._flashMessagesService.show( message , { cssClass: 'flashfade alert-success', timeout: 6000 });

@lokeshrmitra
Copy link

@seantrant
have you tested the above? does it actually work?
In my case custom css classes didn't work

@dduraeso
Copy link

@lokeshrmitra for this to work you need to add the css rules to styles.css

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants