jQuery.madWindow

This lightweight (8.532 KB) plugin provides robust messaging windows for alerts, dialogs, lightboxes and more. It includes an assortment of behaviors to control the open, display and close functionality, and extensible themes to change the appearance.

The content can be passed for simple message windows, or madWindow can be bound to an existing DIV for complex lightboxes, videos, or web-forms.

Download at GitHub.

Demos

Simple Message
Default options

Simple Message with Behavior
Behavior: bottomCenter

Message with Theme and Behavior
Theme: Alert, Behavior: topRight, Close-Timeout: 5 sec.

Message with Theme and Behavior
Theme: Error, Behavior: topLeft, Close-Timeout: 5 sec.

Message with Theme and Behavior
Theme: Info, Behavior: bottomRight, Close-Timeout: 5 sec.

Bound Content with Theme and Behavior
Theme: Confirm, Behavior: bottomCenter

Bound Content with Theme and Behavior
Theme: Default with local 'web-form' styles and scripts, Behavior: autoCenter, Modal with scrolling disabled.

Bound Content with Theme and Behavior
Theme: Default with local 'lightbox' styles and scripts, Behavior: autoCenter, Modal with scrolling disabled, ExpireDays: 30, Callbacks: GA Event Tracking.
(Note: Clear the cookie to reopen the dismissed window.)

GDPR Example: Bound Content with 3s Open Delay and Behavior
Theme: Default with local 'lightbox' styles and scripts, Behavior: bottomCenter, ExpireDays: 365, Callbacks: Loading Scripts.
(Note: Clear the cookie to reopen the dismissed window.)

Configuration Example


		<script>

			jQuery(document).ready(function ($) {

				'use strict';

				/* Pass content using notice options. */
				$(window).madWindow("open",
				{
					messageTitle: "Aenean nec turpis neque.",
					messageContent: "Aliquam a enim felis. Mauris eleifend ipsum vel felis suscipit et rhoncus turpis tristique."
				});
			}

		</script>

	</body>
</html>



		<div id="myWindow_1" class="mad-window" style="display: none">
			<div class="mad-window-closebox"></div>
			<div class="mad-window-container">
				<div class="row">
					<p class="headline">Aenean nec turpis neque.</p>
					<p>Aliquam a enim felis. Mauris eleifend ipsum vel felis suscipit et rhoncus turpis tristique.</p>
					<div class="mad-window-actionButton">Call to Action</div>
				</div>
			</div>
		</div>

		<link rel="stylesheet" href="jquery.madWindow.css">
		<script src="scripts/jquery.madWindow.js"></script>

		<script>

			jQuery(document).ready(function ($) {

				'use strict';

				/* Bind to An existing DIV for content. */
				$("#myWindow_1").madWindow("open",
				{
					theme: "default hanging-close",
					behavior: "autoCenter",
					cookieName: "mad-cookie",
					expireDays: 30,
					width: 600,
					closePadding: 15,
					modal: true,
					openDelay: 5
				});
			}

		</script>

	</body>
</html>

Options

messageTitle: null

The title text to display when not bound to an existing div.

messageContent: null

The message text to display when not bound to an existing div.

messageButtonShow: false

Whether to add a close button when not bound to an existing div.

messageButtonLabel: "Ok"

The value of the close button when not bound to an existing div.

theme: "default"

Premade packages to customize the look and feel of the window.

behavior: "autoCenter"

Used to customize the open, display and close animations.

cookieName: "mad-cookie"

The identifier used for the cookie used to record a dismissed window.

expireDays: 0

The number of days that the dismissed window cookie persists.

width: 400

The maximum width of the notice.

closePadding: 0

Extra space left of the notice to accomodate a hanging closebox.

speed: 500

Number of miliseconds for the open and close animations.

modal: false

Show a dark overlay under the notice and over the page.

modalClose: true

Allow clicks on the background to close the notice.

modalSpeed: 250

Number of miliseconds for the modal overlay animation.

disableScroll: false

Disable scrolling of the page under the notice.

disableMethod: "auto"

The method used to disable scrolling.

openDelay: 0

Number of seconds to delay opening the notice.

closeTimeout: 0

Number of seconds until an open notice closes itself.

openCallback: function() {}

A function to execute upon notice open.

closeCallback: function() {}

A function to execute upon notice close.

hiddenCallback: function() {}

A function to execute if the window has been hidden by the cookie.

Copyright © 2021 - Brian P. Mucha