Basic
This is the very basic toast. The toast has only content text in it. Calling $.toaster(/content/)
will only show the content toast it self, except other options alredy been be set by calling $.toaster.setDefault(/options/)
.
<button type="button" class="btn btn-primary" onclick="op1()">
Launch demo toast
</button>
<script>
function op1(){
$.toaster('Hello, world! This is a toast message.')
}
</script>
With Title
Adding the second parameter on calling $.toaster
function will add title to the toast.
<button type="button" class="btn btn-primary" onclick="op2()">
Launch demo toast
</button>
<script>
function op2(){
$.toaster('Hello, world! This is a toast message.', 'Bootstrap Toaster')
}
</script>
With Title And Info
To add more parameters to the title, please use object as the title instead of string..
<button type="button" class="btn btn-primary" onclick="op3()">
Launch demo toast
</button>
<script>
function op3(){
$.toaster('Hello, world! This is a toast message.', {
text: 'Bootstrap Toaster',
info: '11 mins ago'
})
}
</script>
With Title And Image
To add more parameters to the title, please use object as the title instead of string..
<button type="button" class="btn btn-primary" onclick="op3a()">
Launch demo toast
</button>
<script>
function op3a(){
$.toaster('Hello, world! This is a toast message.', {
text: 'Bootstrap Toaster',
image: 'http://...'
})
}
</script>
With Title And Icon
To add more parameters to the title, please use object as the title instead of string..
<button type="button" class="btn btn-primary" onclick="op3b()">
Launch demo toast
</button>
<script>
function op3b(){
$.toaster('Hello, world! This is a toast message.', {
text: 'Bootstrap Toaster',
icon: 'fa fa-heart'
})
}
</script>
Position
Toast can be put on a different position. Combine vertical position ( top
, bottom
) and horizontal position ( left
, center
, or right
) to put it other place on screen.
<button type="button" class="btn btn-primary" onclick="op4()">
Launch demo toast
</button>
<script>
function op4(){
$.toaster({
content: 'Hello, world! This is a toast message.',
position: 'bottom left'
})
}
</script>