Modal

Download it now

Modal

The Base class

Show me a basic modal

Modal is the parent to all the other modal classes, it handles all the gritty show, hide, toggle, etc functionality that is expected of a modal window. The reason for most of the function returning self, is for easy chaining of function calls.

The funtions are:

The options are:

optionExplanation
idThe id of the modal window div. defaults to 'modal'. Has to be unique for each modal on page
overlayIdThe id of the overlay div. defaults to 'overlay'. Has to be unique for each modal on page
classNamethe css class-name of the modal window. defaults to 'modal'
overlayif the modal should have a overlay over the rest of the page when it's showing.defaults to true
widthdefault width of the modal window. defaults to 'auto'
heightdefault width of the modal window. defaults to 'auto'
titleThe default title of the modal window. defaults to ''
overlayColorthe color of the overlay as string representing a hexadecimal number. defaults to '#000000'
overlayOpacitythe opacity of the overlay as a floating point number between 0 and 1. defaults to 0.85
closeOnOverlayhide the modal when the user clicks the overlay?defaults to true
effectwhat effect to run when showing/hiding the modal. can be 'appear' | 'blind' | 'slide' | 'none'. defaults to 'appear'
effectDurationhow long the show/hide effect will run in seconds. defaults to 0.5
verticalvertical alignment of the modal-window. Can be 'top' | 'center' | 'bottom'. defaults to 'center'

Modal.Notify

Easy user notifications

What just happened?

Modal.Notify() inherits all the functions and options from Modal() (prototype.js' class functions are awesome) and adds a few options of it's own.

The functions are:

The options are:

OptionExplanation
notificationThe notification to be displayed to the user (e.g "The action executed successfully!").
okTextThe text on the "ok button" (the button that closes the box and confirms that the user has seen the notification). Defaults to "OK"
iconURLif you want to use a icon to convey your message, this is the option to use.

Modal.Confirm

Are you sure?

show me the example

The confirm modal is an unobtrusive way to make sure a user really wants to execute a action. Like the other classes the confirmation modal inherits all the options and functions from Modal(), and here is what it brings to the table

Well, it has no functions specific to itself, but it does have some options

OptionExplanation
confirmTextThe confirmation text to be displayed to the user
yesTitleThe text to be displayed on the "yes button" (or positive action button)
noTitleThe text to be displayed on the "no button" (or negative action button)
onYescallback function to be run if the user presses the "yes button"
onNocallback function to be run if the user presses the "no button"

Modal.Image

popup images, please!

Examplify it!

It's not meant to be as fancy as the lightboxes out there, just to work without that many glitches.. you an select access keys work and you can allow warp around

A design thumbnail for the design another_flower A design thumbnail for the design brick_wall A design thumbnail for the design flower1 A design thumbnail for the design vibrant