new Responsiville.Popup(options)
Creates and initialises the popup.
Name | Type | Description |
---|---|---|
options |
Object | The initialisation options of the module. |
- License:
- Nevma Copyright (c) http://www.nevma.gr
Properties:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | The options that define the object
behaviour.
Properties
|
Fires:
Extends
Members
-
staticResponsiville.Popup.AUTO_RUN
-
Properties:
Name Type Description AUTO_RUN
boolean Controls whether this module should run by default, without the developer calling it, using its default settings. Defaults to true. -
staticResponsiville.Popup.AUTO_RUN
-
Properties:
Name Type Description AUTO_RUN
boolean Controls whether this module should run by default, without the developer calling it, using its default settings. Defaults to true. -
staticResponsiville.Popup.defaults
-
Properties:
Name Type Description defaults
Object Default values for this module settings. -
staticResponsiville.Popup.defaults
-
Properties:
Name Type Description defaults
Object Default values for this module settings.
Methods
-
staticResponsiville.Popup.autoRun(){void}
-
Runs through the page and searches for elements that apply to the current module in order to apply it to them automatically. Useful for automatically creating elements with this module's behaviour just by setting up the predefined classes and data attributes in HTML elements of the page.
Returns:
Type Description void -
staticResponsiville.Popup.autoRun(){void}
-
Runs through the page and searches for elements that apply to the current module in order to apply it to them automatically. Useful for automatically creating elements with this module's behaviour just by setting up the predefined classes and data attributes in HTML elements of the page.
Returns:
Type Description void -
calculateContentsDimensions(){object}
-
Calculates the dimensions that the popup contents will need when they appear in order for the popup to proactively grow to them in advance. It takes under consideration both the contents themselves as well as limitations provided by the given popup options that relate to its dimensions.
Returns:
Type Description object An asspociative array with the calculated width and height of the current popup contents. -
closePopup(){void}
-
Closes the popup. First hides the popup contents container and then the popup contents wrapper.
Fires:
Returns:
Type Description void -
contentsClick(event){void}
-
Handles the click event on the popup contents in order to stop it from propagating behind the popup and towards the rest of the page.
Name Type Description event
Event The click event sent by the browser. Returns:
Type Description void -
disable(){void}
-
Disables the popup. It does not deactivate it. It simply disables it, so it does not function any more when the necessary trigger is fired. Useful in responsive design where the popup might be a required feature in desktops but useless in mobile devices.
Returns:
Type Description void -
documentKeyDown(event){void}
-
Handles keyboard events on the document level in order to close the popup when the escape key is pressed.
Name Type Description event
Event The keyboard event sent by the browser. Returns:
Type Description void -
enable(){void}
-
Enables the popup. It does not activate it. It simply enables it, so when the necessary trigger is fired then the popup opens/closes. Useful in responsive design where the popup might be a required feature in desktops but useless in mobile devices. By default a popup is always enabled.
Returns:
Type Description void -
hideContents(callback){void}
-
Hides the popup contents container.
Name Type Description callback
function A function to execute after the popup contents container has finshed hiding. Returns:
Type Description void -
hideContentsWrapper(callback){void}
-
Hides the popup contents wrapper.
Name Type Description callback
function A function to execute after the popup contents wrapper has finshed hiding. Returns:
Type Description void -
initContents()
-
Inittialises the contents of the popup based on the given options.
-
initHTML()
-
Sets up the necessary helper HTML elements for the function of the popup.
-
openPopup(){void}
-
Opens the popup. First shows the popup contents wrapper and then the popup contents container.
Fires:
Returns:
Type Description void -
parseInt(number){int}
-
Wraps around the window.paresInt() function and returns zero (0) when the given argument is not a number (NaN).
Name Type Description number
Number The number to parse as an integer. Returns:
Type Description int -
resize(){void}
-
Re-arranges the popup, its layout position and dimensions to the screen as its options dictate. It is called every time the popup contents change or the window is resized or whenever the popup needs to update its view.
Fires:
Returns:
Type Description void -
setContents(contents){void}
-
Sets and updates the contents of the popup. Can be called either when the popup is open or when it is closed. If open then the popup will automatically resize itseld appropriately. if the contents contain images then the popup will watch them until they load and then resize itself again.
Name Type Description contents
mixed The new popup contents. Can be anything that makes sense, an HTML string, a DOM element or a set of jQuery elements. Returns:
Type Description void -
setupEvents(){void}
-
Sets up event handlers necessary for the object to function properly.
Returns:
Type Description void -
showContents(callback){void}
-
Shows the popup contents, that is the actual popup contents container.
Name Type Description callback
function A function to execute after the popup contents container has finshed showing. Returns:
Type Description void -
showContentsWrapper(callback){void}
-
Shows the popup contents wrapper, the layer that contains the popup and makes it stick above the rest of the page contents.
Name Type Description callback
function A function to execute after the popup contents wrapper has finshed showing. Returns:
Type Description void
Events
-
beforeResize
-
Called before the popup starts opening.
-
close
-
Called after the popup has been closed.
-
closing
-
Called before the popup starts closing.
-
Called after the popup has been created.
-
Called after the popup has been opened.
-
opening
-
Called before the popup starts opening.
-
resize
-
Called before the popup starts opening.