chrisgo / bootstrap5-toast Goto Github PK
View Code? Open in Web Editor NEWMakes Bootstrap 5.x Toasts easier to use
Makes Bootstrap 5.x Toasts easier to use
Maybe the delay shoule be more flexible.
instead of:
let delayOrAutohide = opts.delay ? `data-delay="${opts.delay}"` : `data-autohide="false"`;
maybe:
let delayOrAutohide = opts.delay ? `data-delay="${opts.delay}"` : `data-bs-autohide="false"`;
The doc implies that delay
argument can be omitted, and the toast will stay until manually dismissed:
Note: The final argument delay is omitable. If omitted, the toast will remain forever.
This does not seem to be the case... For example:
// This works, toast is shown and hidden after delay
$.toast({type: "error", title: "Test", content: "test", delay: 3000})
// This does not work - toast is hidden immediately after being shown (so it never even appears on screen)
$.toast({type: "error", title: "Test", content: "test"})
This piece of code runs right after the toast is shown:
setTimeout(function () {
if (!paused) {
$(`#${id}`).toast('hide');
}
}, opts.delay);
If delay
is omitted, opts.delay
here is undefined
, so setTimeout
fires immediarely, and as paused
is false
, the toast is immediately hidden...
Even more confusingly, same code/bug is also present in the original library.. with the last commit years ago (.. how am I the first one discovering this?).
Maybe should add the primary background too - in "render":
case 'primary':
classes.header.bg = $.toastDefaults.style.info || 'bg-primary';
classes.header.fg = $.toastDefaults.style.info || 'text-white';
break;
toasy.js:120,
it is:
_dimissable = '';
it should be:
_dismissable = '';
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.