moff / angular2-flash-messages

Angular 2 flash messages module
52 stars 21 forks source link

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

Open darsana opened 7 years ago

darsana commented 7 years ago

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 commented 7 years ago

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

seantrant commented 7 years ago

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 commented 6 years ago

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

dduraeso commented 6 years ago

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