Lightweight Android Style Snackbar Plugin For jQuery - Smackbar

File Size: 26.9 KB
Views Total: 1225
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Lightweight Android Style Snackbar Plugin For jQuery - Smackbar

Smackbar is a super small (~2kb) jQuery plugin used to create Android and Material Design inspired snackbars that will automatically disappear after a timeout or after user interaction.

How to use it:

1. Load the main style sheet smackbar.css in the header of the document to style the snackbars.

<link href="smackbar.css" rel="stylesheet">

2. Load JQuery library and the JavaScript file smackbar.js at the end of the document to improve the page load time.

<script src="//"></script>
<script src="smackbar.js"></script>

3. Display a default snackbar with custom message text in the screen.

  message: 'Hello World!'

4. Display a default snackbar with a custom button in the screen.

  message: 'Hello World!',
  button: {
    text: 'Dismiss',
    onclick: function() {
      console.log('clicked the button')

5. Change the default autohide timeout.

  message: 'Hello World!',
  timeout: 4000

6. Fire a callback function when the snackbar is closed.

  message: 'Hello World!',
  onclose: function() {
    // ...

Change log:


  • use var again since no js transpiler is there yet


  • add higher timeout to ensure animation
  • nested in parent class, fix transition


  • v1.1.0


  • throw error when no args are given
  • changed 'toast' to 'smackbar'

This awesome jQuery plugin is developed by steebchen. For more Advanced Usages, please check the demo page or visit the official website.