ish.responsive(options)
Description:
Calls an event when breakpoints are reached. Needs a prototypal review.
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| options |
|
Properties
|
Fires:
- event:onMediaBreak
Example:
var mediaBreaks = ish.responsive({
breakpoints: [{
name: 'mobile',
width: 0
}, {
name: 'tablet',
width: 640
}, {
name: 'desktop',
width: 1024
}],
eventPrefix: 'ish.responsive'
});
mediaBreaks.subscribe('onMediaBreak', function(data){
console.log('Media break: ',data.name);
});
Extends
Events
onMediaBreak
Properties:
| Name | Type | Description |
|---|---|---|
name |
String
|
The name of the breakpoint as defined in the options object. |
Description:
An event/action emitted by ish.emitter.
Example:
mediaBreaks.subscribe('onMediaBreak', function(data){
console.log('Media break: ',data.name);
});
Properties
destroy
line 140Removes all breakpoints for the instance and returns null. We cannot destroy the module internally, but you can use the return value to null out your references if you wish.
Example
mediaBreaks.destroy();
Methods
add(settings)
Description:
Add one or more breakpoints to the instance.
Parameters:
| Name | Type | Description |
|---|---|---|
| settings |
|
An Array containing breakpoint settings. |
remove(settings)
Description:
Remove one or more breakpoint object from the instance.
Parameters:
| Name | Type | Description |
|---|---|---|
| settings |
|
An Array containing breakpoint settings. |