Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Add container option #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add container option #53

wants to merge 2 commits into from

Conversation

kevguy
Copy link

@kevguy kevguy commented Feb 1, 2017

The original adds a <div> with id snackbar-container by default and appends new snackbars to the container. Though we also have an id option to configure where we want to add a new snackbar, their behaviors are different that the ones in the snackbar-container since some of the code like click handlers are hardcoded for #snackbar-containers only. I think more can be done by letting user set where they want to add the new snackbars but still have the same behaviors like the default container.

An example usage is this:

var options =  {
    container: "new-container",
    content: "message for snackbar", // text of the snackbar
    //style: "toast", // add a custom class to your snackbar      
    onClose: function(){ // callback called when the snackbar gets closed.
        console.log('closing');
    },
    timeout: 5000 // time in milliseconds after the snackbar autohides, 0 is disabled,
};

$.snackbar(options);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant