codeseven / toastr Goto Github PK
View Code? Open in Web Editor NEWSimple javascript toast notifications
Home Page: http://www.toastrjs.com
License: MIT License
Simple javascript toast notifications
Home Page: http://www.toastrjs.com
License: MIT License
๐
We recently have started using toastr due to the simple nature of calling it versus other javascript notifications. One fallback that was causing me to look at other options was the ability to display messages across the top or bottom of the screen as a full bar. I think toastr is very user friendly as a simple corner notification, but for some apps my users will want a notification that says "Stop!" and not a simple corner notification.
It would be wonderful to have toastr in the Bower database.
Sorry for simple question.
I included toastr.js, toastr.cs and toastr.-responsive.css
This works:
toastr.info("Hello world");
But this doesn't work. And I don't get any error in browser console.
toastr.options.positionClass = "toast-top-full-width"; toastr.info("Hello world");
What would be the cause ?
It would be great if I could have a toast appear on any container that I would set rather than just the body tag at large
Can we have an option to set the url when a notification is clicked? Instead of just closing it.
Bootstrap currently uses other ranges for responsiveness.
I think the following sizes should be used to get messages resized at the same time with the rest of the layout:
@media all and (min-width: 241px) and (max-width: 319px) ...
@media all and (min-width: 320px) and (max-width: 479px) ...
@media all and (min-width: 480px) and (max-width: 767px) ...
@media all and (min-width: 768px) ...
Update docs/demo site with new features introduced in 1.0.3.
Can you please share sample code ? for the different types of notification shown in the demo page ?
In the readme file, there still has a reference to the responsive stylesheets, althought they are now included in the main CSS file.
hi,
great library, but can we have a default close button in the corner of a toaster so when user click it closes the toaster instance ?
thanks in advanced
bad experiment
Per my conversation with John, it would be nice if you can set up the object that contains the various options and have that be received as an argument in the Toastr call so a) it can apply to only one toast, and b) you can do it inline with the call and have less code. It's still handy to have it apply to all toasts if you leave it out as an argument.
add this function on click event to prevent infinite "mouseenter mouseleave" loop.
(after hover at line 123)
$toastElement.hover(stickAround, fadeAway)
$toastElement.click(function() {
$(this).off('mouseenter mouseleave');
fadeAway();
})
From nuget, I install into a fresh MVC 3 project jQuery 1.9.1, then toastr 1.2.1 using the nuget package manager.
The following html file:
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="utf-8"/>
<link href="Content/toastr.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery-1.9.1.js" type="text/javascript"></script>
<script src="Scripts/toastr.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
toastr.options = { debug: true };
toastr.info("Hello? Is This thing on?");
toastr.success("Anything");
toastr.error("Nada.");
});
</script>
</head>
<body>
</body>
</html>
shows nothing in Google Chrome v 25.0.1364.97 m nor IE 9 on Windows 7.
If I uninstall toastr 1.2.1 and Install-Package toastr -Version 1.1.4.2 it works just dandy.
With 1.2.1 I get nothing - the debug messages print, but don't seem to contain anything useful.
Thanks!
Currently, hovering over a node only makes the notification that you are hovering over sticky. I spent a couple of hours trying to write an option that would cause hovering over a notification to keep all displayed notifications sticky but I don't have a real good feel for how to do this.
I not exactly comfortable in JavaScript, and my attempts failed. I made a little bit of progress. I was able to make all the notifications not fade out when hovering one, all notifications fade out when hovering stops, but there were a lot of bugs that I couldn't work out after a while.
So, I figured I would throw it up here in case someone else wants to take a crack at the idea.
Some of the systems I use may have multiple notifications pop-up at once and the user doesn't have time to read them all before they start disappearing. I could set them to click to remove, but they don't want the extra clicks. Neither do they want longer timeouts for messages that they aren't interested in. So, hover over one to keep all on the screen seems an appropriate feature (and has been used by the system in the past).
If someone wants to give me tips on how to go about it, I would be more than happy to take another crack at it.
It would be nice if there was a way to optionally pass in your own icon, or better yet, pass in a Font Awesome icon.
Great library though, thanks!
You can position it on the left or the right, but I don't see any way to position the message in the centre of the page. Would it be possible to add this?
I added a new feature to keep the toast around after hover-off for an extended 1 second (customizable). The option is called extendedTimeOut
I really like the form it allows to have in a toast and I was wondering if it would be hard to allow checkboxes and radio buttons since right now a simple click on a checkbox would dismiss the toast.
and when you reach this limit, you may add the the subsequent toasts to a "queue"?
๐
toastr.info('a', null, {
positionClass: 'toast-top-right'
});
toastr.info('a', null, {
positionClass: 'toast-bottom-left'
})
Second toast is shown in top right position
This is a great plugin! Would it be possible to have toastr work with jQuery 1.4.4?
The reason being is I am using the Drupal 7 framework which forces developers to use 1.4.4.
Can be seen on the demo page, if you display a toast and then either clear it or let it time out clicking on show toast will not display any new toasts.
๐
I noticed that at certain times the user finds it difficult to read a sequence of notifications, because they disappear quickly.
I suggest an option to group the toast by type (success, info, warning, error) showing the number of notifications that have the same type.
and then, when you dismiss a toast, the toast that is "behind" is displayed and the number of notifications decreased.
hi,
beautiful library,
but could we add a small close button on any corner so user can know that the notification can be closed ?
thanks in advanced.
Helps for custom clear, empty, remove, position, etc.
Maybe I missed something but anyone how to make the notification show in the center position except that "top, bottom, left, right"? Thanks a lot.
As seen in the demo at http://codeseven.github.com/toastr/, the "Tap to dismiss toast" option causes the toast to close when clicking in the textbox.
It would be nice to emulate what Outlook popups do when the user hovers the mouse over it.
So you'd need to reset the timer, but if the fadeout has already begun, you'd need to fade back in, and reset the timer.
BTW, nice work guys.
Luc
Any way to clear() the existing toastr and not to let the new toastr disappear with existing ones?
e.g.
toastr.info('msg 1');
toastr.info('msg 2');
toastr.info('msg 3');
toastr.clear();
toastr.info('msg 4');
In this sequence, msg 4 fades out with preview 3 popups.
I've implemented toastr on a website but I'm finding that more than a few users are confused about how to close the toasts that do not disappear on their own.
I initialize them as such: {timeOut: 0, extendedTimeOut: 0} and while it works fine functionally, it doesn't convey to the user how to dismiss the toast.
So I was wondering if there could also be an option to show a small 'X' close button/text in the top right corner of the toast to help make it obvious that they have to click to close it?
Hey guys,
did you ever try to use toastr in PhoneGap...? It does not work (for me).
Any ideas?
Thanks.
Hi, is it necessary to save all files with BOM ? I notice problem in some automatic assets management libraries. I think you can safely remove it without any problem. Thanks
Toasts are displayed with the values from the defaults object regardless of supplying an options object in the function calls.
I am using toastr to show notification...I want to call a function to update some details when the notification is closed(i.e clicked on the notification)..Is there any way to do it with toastr.
I read about this plug in in Visual Studio magazine and it looks awesome. I am pretty new to jQuery and am trying to fibure out how to communicate with my ASP.Net backend. Say, I have an update occuring on a page, how do I get the message (error or otherwise) from the c# code to the plug in and then trigger the display.
Sorry for the newbie question.
Potential fix:
.toast-message {
word-wrap: break-word;
}
I like the enhanced functionality of toastr (like .warning, etc) and if it could be more condensed like sticky js (http://thrivingkings.com/sticky/) I would be more likely to consider it.
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.