Welcome to responsive.js wiki, here you can find the documentation for r$ library.
Responsive.js is a tiny javascript library that extends the classic techniques of responsive web design using the concept of "dynamic media query/css styles client rendering".
Define your responsive css rules using a functional notations with fluent interface:
property(element) = function(width) become r$.set(property).as(function(width){return func(width)}).applyTo(selector);
results in dynamic client rendering of media query rappresenting a discrete function slicing width axis (with w from minWidth to maxWidth and epsilon an arbitrarily small positive quantity):
...
@media only screen and (min-width:w-ε) and (max-width:w) { selector { property:func(w-ε)}}
@media only screen and (min-width:w) and (max-width:w+ε) { selector { property:func(w)}}
@media only screen and (min-width:w+ε) and (max-width:w+2ε) { selector { property:func(w+ε)}}
...
or in a dynamic rendering or the right css rules for the current width.
Its also available linear interpolation as :
r$.breakpoints(b1,b2,b3,...bn);
r$.set(property).values(v1,v2,v3,..vn).linear().applyTo(selector);
and many other features.
<script type='text/javascript' src='responsive.js' />
The base singleton object you must use to access all functionality of responsive.js is named r$. It is based on the concept of Fluent Interface.
A fluent interface is an Object Oriented programming model based on using method chaining to relay the instruction context of a subsequent call.
There is three kind of context :
Methods | Descriptions |
---|---|
settings | Allows to get or set responsive.js settings. usage r$.settings() return current settings. r$.settings(setting) set new settings. (setting is a JSON object) List of setting property
|
start | enable r$ functionalities. |
stop | disable r$ functionalities. |
reset | reset r$ rules and events. |
render | render defined rules. |
breakpoints |
define the default breakpoints points. usage r$.breakpoints(300,480,800,1200,1600); r$.breakpoints([300,480,800,1200,1600]); |
fireEvents | call all events handlers (functions,dynamic, etc.) |
extend |
allow to extend r$ functionalities. usage r$.extend(module1,module2,....,modulen); r$.extend(module); |