<script src="https://unpkg.com/flashy-js@latest/dist/flashy.min.js"></script>
<flash-messages data-max-messages="5"></flash-messages>
<script>
// now you have Flashy available as a global varirable
Flashy('flash-messages', {
type: 'success',
title: 'Now you can use flashy',
message: `Simply call the Flashy
function like this`,
globalClose: true,
expiry: 5000
});
</script>
Flashy('.my-flash-message-element', {
type: 'error',
text: 'error example',
message: `This is what an error
flash looks like!`,
});
Flashy('.my-flash-message-element', {
type: 'warning',
text: 'warning example',
message: `This is what a warning
flash looks like!`,
});
Flashy('.my-flash-message-element', {
type: 'info',
text: 'info example',
message: `This is what an info
flash looks like!`,
});
Flashy('.my-flash-message-element', {
type: 'success',
text: 'success example',
message: `This is what a success
flash looks like!`,
});
Flashy('.my-flash-message-element', {
type: 'info',
title: 'custom styling',
message: 'look at these styles',
globalClose: true,
styles: {
flashColor: '#3d3737',
titleTextColor: 'salmon',
msgTextColor: 'salmon',
titleTextFont: `Arial,
Helvetica ,sans-serif`,
msgTextFont: `Arial, Helvetica,
sans-serif`,
iconBackgroundColor: '#291010',
},
});
Flashy('.my-flash-message-element', {
type: 'info',
title: 'custom emoji',
message: 'check out the emoji!',
globalClose: true,
styles: {
icon: {
type: 'unicode',
val: '🤑',
},
},
});
Flashy('.my-flash-message-element', {
type: 'success',
title: 'something happened',
message: 'you have to click ok',
globalClose: false,
buttons: [
{
text: 'OK',
closesFlash: true,
},
],
});
Flashy('.my-flash-message-element', {
type: 'error',
title: 'something happened',
message: 'you can click okay or cancel',
globalClose: false,
buttons: [
{
text: 'OK',
closesFlash: true,
},
{
text: 'Cancel',
closesFlash: true,
},
],
styles: {
linkTextColor: 'black',
},
});
function secretFunction() {
alert('wow');
}
Flashy('.my-flash-message-element', {
type: 'warning',
title: 'something happened',
message: 'click ok!',
globalClose: true,
buttons: [
{
text: 'OK',
closesFlash: false,
action: secretFunction,
},
],
});