Changed toast to remove footer

This commit is contained in:
Ray 2023-08-21 01:52:54 +01:00
parent 102a3d1c01
commit d9b41dab54
3 changed files with 32 additions and 9 deletions

View File

@ -47,7 +47,7 @@
<p><b>Example Three</b></p>
<p>Launch an empty modal then update its title, body, footer and size.</p>
<div class="alert alert-secondary">
BSDialog.ShowToast('abc123', 'My Modal Box 123', null, 'sm');<br />
BSDialog.Create('abc123', 'My Modal Box 123', null, 'sm');<br />
BSDialog.UpdateTitle('abc123', 'My Modal Box 567');<br />
BSDialog.UpdateBody('abc123', 'Help, I\'m toast!');<br />
BSDialog.UpdateFooter('abc123', '');<br />
@ -63,13 +63,25 @@
<p><b>Example Four</b></p>
<p>Launch a multiple modals</p>
<div class="alert alert-secondary">
BSDialog.ShowToast('abc123', 'My Modal Box 123', 'Help! I\'m toast.', 'sm');<br />
BSDialog.ShowToast('abc123456', 'My Modal Box 123.567', 'Help! I\'m a second toast.', 'md');<br />
BSDialog.Create('abc123', 'My Modal Box 123', 'Help! I\'m toast.', 'sm');<br />
BSDialog.Create('abc123456', 'My Modal Box 123.567', 'Help! I\'m a second toast.', 'md');<br />
</div>
<p><button id="button4" type="button" class="btn btn-primary">Launch Modal</button></p>
</div>
</div>
<div class="row mb-3 border-bottom">
<div class="col-12">
<p><b>Example Six</b></p>
<p>Show a toast-style modal</p>
<div class="alert alert-secondary">
BSDialog.ShowToast('abc123', 'My Modal Box 123', 'Help! I\'m toast.', 'sm');<br />
</div>
<p><button id="button6" type="button" class="btn btn-primary">Launch Modal</button></p>
</div>
</div>
<div class="row mb-3 border-bottom">
<div class="col-12">
@ -109,7 +121,7 @@ $(document).ready(function(){
});
$("#button3").on('click', function(){
BSDialog.ShowToast('abc123', 'My Modal Box 123', null, 'sm');
BSDialog.Create('abc123', 'My Modal Box 123', null, 'sm');
BSDialog.UpdateTitle('abc123', 'My Modal Box 567');
BSDialog.UpdateBody('abc123', 'Help, I\'m toast!');
BSDialog.UpdateFooter('abc123', '');
@ -117,8 +129,12 @@ $(document).ready(function(){
});
$("#button4").on('click', function(){
BSDialog.Create('abc123', 'My Modal Box 123', 'Help! I\'m toast.', 'sm');
BSDialog.Create('abc123456', 'My Modal Box 123.567', 'Help! I\'m a second toast.', 'md');
});
$("#button6").on('click', function(){
BSDialog.ShowToast('abc123', 'My Modal Box 123', 'Help! I\'m toast.', 'sm');
BSDialog.ShowToast('abc123456', 'My Modal Box 123.567', 'Help! I\'m a second toast.', 'md');
});
$("#button5").on('click', async function(){

View File

@ -133,11 +133,19 @@ var BSDialog = {
};
},
ShowToast: function (id, title, message, size) {
this.Create(id, title, null, size);
this.UpdateBody(id, message);
const a = this;
a.Create(id, title, null, size);
a.UpdateBody(id, message);
const modal = a.Find(id);
modal.Footer.forEach(function(e) {
e.parentNode.removeChild(e);
});
},
ShowPrompt: async function (options) {
let a = this;
const a = this;
let id = "prompt" + Math.floor(Math.random() * 10000) + 1000;
const _options = Object.assign(a.DefaultPromptOptions, options);

1
bsdialog4.min.js vendored

File diff suppressed because one or more lines are too long