Namespace: Responsiville

Responsiville

The main Responsiville framework scope. It defines the scope and some general usage important functions used throughout the framework in responsive web development.

Classes

Accordion
Drawers
Equalheights
Lazymg
Main
Megamenu
Megamenu
Mobimenu
Parallax
Popup
Popup
Responsiveelement
Scrollmenu
Slideshow

Namespaces

Debug
Events
Run

Members

staticResponsiville.THROTTLE_DURATION

Properties:
Name Type Description
THROTTLE_DURATION int The default throttle duration of the framework.

staticResponsiville.VERSION

Properties:
Name Type Description
VERSION String The current version of the framework.

Methods

staticResponsiville.createResponsiveObject(responsiveObject){object}

Takes an object and enhances with responsive behaviour.
Name Type Description
responsiveObject object The object which is to be enhanced with responsive behaviour. It must contain 'enter' and/or 'leave' properties which define the respective breakpoints in the same manner in which Responsiville elements do and an 'enable' and 'disable' callback functions which will be automatically invoked by the framework as per the given breakpoints. The given object will be enhanced with this responsive behaviour, thus it can still keep any other properties and previous behaviour it had.
Returns:
Type Description
object The given object enhanced.

staticResponsiville.debounce(theFunction, delay, scope){function}

Takes a function and returns a version of it that, when called repeatedly, its execution is postponed for at least as much as the given interval indicates. This means that, when called repeatedly, if the repetitions of its calls are within the given interval with each other, the function will only run once, in the end.
Name Type Description
theFunction function The function to debounce.
delay int The time delay inside which the given function should to be debounced should not be executed.
scope Object The object scope in which the debounced function is required to run.
Returns:
Type Description
function The throttled function.

staticResponsiville.determineEnableDisableBreakpoints(breakpoints){object}

Takes a set of enter/leave values, as given in a Responsiville module's HTML data attributes, and determines the exact actual breakpoints that the developer implied. The enter/leave valuesmay contain either the breakpoint names themselves or shortct names, like "*" (all breakpoints), "tablet >>" ( tablet and above), "<< laptop" (laptop and below), etc.
Name Type Description
breakpoints object An object with an "enter" and a "leave" key string values which represent the enter and leave values given in the Responsiville module's HTML data attributes. Each of them may be provided or left undefined. If both are undefined then null is returned.
Returns:
Type Description
object An object with an "enter" and a "leave" key string values which represent the final enter and leave values after they have been decoded to cover all available breakpoints.

staticResponsiville.extend(prototype, namespace){void}

Extends a given function/class with the functions of a given namespace. The given namespace has to contain proper functions designed to extend a prototype, otherwise unexpected behaviour might occur.
Name Type Description
prototype Object The function/class that is to be extended. Has to be a class defining function.
namespace Object The namespace of functions which will extend the given function/class prototype.
Returns:
Type Description
void

staticResponsiville.hasImageLoaded(image){Boolean}

Checks whether a given IMG element is fully loaded.
Name Type Description
image HTMLImageElement The IMG element to check.
Returns:
Type Description
Boolean Whether the given IMG element is fully loaded.

staticResponsiville.onImagesLoaded(images, callbacks){void}

Takes a set of images, waits for all of them to completely load (or fail) and executes the given function callback.
Name Type Description
images function The images elements to watch.
callbacks array Associative array of callback functions to call when each single and all images of the given array have finished loading. Can take a 'single" and a 'full' callback function respectively.
Returns:
Type Description
void

staticResponsiville.splitAndTrim(input){Array.<string>}

Takes an input and, if it is not an array, it first converts it to an array by splitting it by the given separator, then takes each element of the resulting array and removes the whitespace from its beginning and end and returns that array. Only applies to strings or arrays of strings. Useful when transforming an unknown input that might contain a single string, a comma separated list of string or an array of strings to a trimmed array of strings.
Name Type Description
input Array.<string> | string The string to split and then trim or the array to simply trim its elements.
Returns:
Type Description
Array.<string> The resulting array of trimmed strings.

staticResponsiville.throttle(theFunction, threshold, scope){function}

Takes a function and returns a version of it that, when called repeatedly, will not run more often than a given time threshold. This way the given function, when called repeatedly, is guaranteed to run, in the worst case, no more often thant the given interval.
Name Type Description
theFunction function The function to throttle.
threshold int The time threshold more often than which the given function to be throttled should not run.
scope Object The object scope in which the throttled function is required to run.
Returns:
Type Description
function The throttled function.