A Pen by Dalin Bahr on CodePen.
Created
June 26, 2022 15:09
-
-
Save xhimalaya/9451a4bee637de9bc9660331ca4b84ac to your computer and use it in GitHub Desktop.
Toastr Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Click <a href="http://codeseven.github.io/toastr/demo.html" target="_blank">here</a> for more examples.</p> | |
<br/> | |
<p>You'll notice that the JS is more or less empty and is just what I need to make the example work.</p> | |
<p>I linked my CodePen to use the following two files:</p> | |
<ul> | |
<li><a href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" target="_blank">toastr.min.css</a></li> | |
<li><a href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js" target="_blank">toastr.min.js</a></li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set the options that I want | |
toastr.options = { | |
"closeButton": true, | |
"newestOnTop": false, | |
"progressBar": true, | |
"positionClass": "toast-bottom-center", | |
"preventDuplicates": false, | |
"onclick": null, | |
"showDuration": "300", | |
"hideDuration": "1000", | |
"timeOut": "5000", | |
"extendedTimeOut": "1000", | |
"showEasing": "swing", | |
"hideEasing": "linear", | |
"showMethod": "fadeIn", | |
"hideMethod": "fadeOut" | |
} | |
$(document).ready(function onDocumentReady() { | |
setInterval(function doThisEveryTwoSeconds() { | |
toastr.success("Hello World!"); | |
}, 2000); // 2000 is 2 seconds | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment