bootstrap-alert-modal
Bootstrap alert and confirm messages using the modal component
Requirements
- Bootstrap v3+
- jQuery v2+
Install
npm i bootstrap-alert-modal
Quick start
<!-- Style --> <!-- Code -->
Options
// Defaultbsamconfig = alertCloseButtonClass : 'btn-primary' alertCloseButtonText : 'Close' confirmHeaderClass : 'text-white bg-warning' confirmTitle : 'Action required' confirmConfirmButtonClass: 'btn-success' confirmCancelButtonClass : 'btn-danger' modalBackdrop : 'static' modalKeyboard : false modalFocus : true; // OverridebsamconfigalertCloseButtonText = 'Close now!';
Option | Type | Default |
---|---|---|
alertCloseButtonClass | string | 'btn-primary' |
alertCloseButtonText | string | 'Close' |
confirmHeaderClass | string | 'text-white bg-warning' |
confirmTitle | string | 'Action required' |
confirmConfirmButtonClass | string | 'btn-success' |
confirmCancelButtonClass | string | 'btn-danger' |
modalBackdrop | string | 'static' |
modalKeyboard | boolean | false |
modalFocus | boolean | true |
Methods
bsam.alert(title, body, code)
Alert modal window with one close button
title
{string} required - Title modal windowbody
{string} required - Any html-contentcode
{string} required - Bootstrap background class suffix (primary, success, danger and etc)
bsam.success(title, body)
Fast facade alert modal window with one close button and predefined background code
title
{string} required - Title modal windowbody
{string} required - Any html-content
bsam.danger(title, body)
Fast facade alert modal window with one close button and predefined background code
title
{string} required - Title modal windowbody
{string} required - Any html-content
bsam.warning(title, body)
Fast facade alert modal window with one close button and predefined background code
title
{string} required - Title modal windowbody
{string} required - Any html-content
bsam.info(title, body)
Fast facade alert modal window with one close button and predefined background code
title
{string} required - Title modal windowbody
{string} required - Any html-content
bsam.confirm(body, confirmButtonText, cancelButtonText, callbackConfirm, callbackCancel, callbackOnOpen)
Confirm modal window with two buttons and callbacks
body
{string} required - Any html-contentconfirmButtonText
{string} required - The text of the button "OK"cancelButtonText
{string} required - The text of the button "CancelcallbackConfirm
{function} - Function run after pressing a button "OK"callbackCancel
{function} - Function run after pressing a button "CancelcallbackOnOpen
{function} - Function run after show modal
var body = '<p>Any <strong>html</strong>-content</p>';var confirmButtonText = 'OK';var cancelButtonText = 'Cancel'; var { bsam;}; var { bsam;}; var { bsam;}; bsam;