Monday, April 1, 2013

Java-script Notifications with Toastr JS

ToastrJS is a simple java script library for notifications in browser which is small and easy to use.

In this post I'll configure ToastrJS for a small application. Create ASP.net MVC internet project. Add ToastrJS using Nuget.
In HomeController add Demo action and related view. Then add another JsonResult action to call using JQuery ajax.
In Demo.chtml add Toastr style sheet and related java scripts. In script level configure for various ToastrJS notifications like below.
ToastrJS has various notifications like
  • info
  • warning
  • success
  • error
When we run the project you'll be able to see those notifications like below.
These notifications will display in bottom-right corner. We can configure this by using toastr.options.positionClass. There we can give top-right, bottom-full-width like wise.
You can find the source of this demo in GitHub.

1 comment: