The messaging from the client-js to the user is a critical function. I developed dynamic-modals.js to display a message
modal. This Generator allows you to create and test your message modal. Edits to the Generator automatically
updates the Generated code block with the fewest parameters needed. A dismiss button and/or a link is required.
The message modal does not implement the close button in the head to force a redirection. Notice a modal created
in the page's html can co-exists with dynamic-modals.js.
showMessageModal('This is called with just a message. You set defaults in dynamic-modals.js.');
showMessageModal('This is called with just a message and class. You set defaults in dynamic-modals.js.',
'alert-secondary');
showMessageModal('You can include a link. Please support KenHaggerty.Com.', 'alert-success', true,
'Later', 'btn-primary', true, 'https://kenhaggerty.com', '_self', 'KenHaggerty.Com');
showMessageModal('Hide Backdrop sets the backdrop to false. With the jQuery modal, clicking outside
the modal will not dismiss the modal. The Bootstrap Native modal sets the backdrop to transparent and
will dismiss the modal on click.', 'alert-warning', true, 'Got It', 'btn-success', true,
'https://getbootstrap.com/docs/5.1/components/modal/', '_blank', 'More', 'btn-info', true);
showMessageModal('We use cookies to analyse usage. See our privacy policy.', 'alert-primary', true, 'Agree',
'', true, '/Privacy', '_blank', 'Privacy Policy');
showMessageModal('You have run out of time. You must start over.', 'alert-dark', false, '', '', true, '/', '_self', 'Try Again');
showMessageModal('Oops! Something went wrong. Please help me fix it by sending me an email about how
to recreate the issue.', 'alert-danger', false, '', '', true, '/', '_self', 'Home');
Page Modal
Modal html added to a page co-exists with the Message Modal.
I request your consent to use non-essential cookies to capture usage metrics like screen size and time zone.
Privacy Policy