outboxcraft / beauter

A simple framework for faster and beautiful responsive sites
https://beauter.io
MIT License
130 stars 15 forks source link

Add text essage into snackbar #18

Open machao81 opened 6 years ago

machao81 commented 6 years ago

Could you modify the showsnackbar method to pass in parameter the text of the snackbar ?

showsnackbar( ID, "my new text" )

ramdeoshubham commented 6 years ago

This one is nice idea! Sure!! I will comment back after adding that! 😀

machao81 commented 6 years ago

I use this if it can help you.

toast = function(text, options ) { let newDiv = document.createElement("div"); newDiv.setAttribute("class","snackbar _primary show "+ options ); newDiv.appendChild(document.createTextNode(text)); document.body.appendChild(newDiv); setTimeout(function(){ document.body.removeChild(newDiv); },3E3); };

The timeout can be another parameter.

Last thing about toast that is the toasts are displayed one on top of the other... You need to implements something to display a second toast at the bottom of the first one.

Anyway, I really like your framework. Keep going!