Giter Site home page Giter Site logo

bootstrap5-toast's People

Contributors

chrisgo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bootstrap5-toast's Issues

Add "primary" background

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;

Misspell

toasy.js:120,

it is:
_dimissable = '';

it should be:
_dismissable = '';

Delay not working because wrong attribute

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"`;

Toast is immediately hidden if `delay` is omitted

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?).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.