The responsive factory

ish.responsive(options)

Description:

Calls an event when breakpoints are reached. Needs a prototypal review.

Returns
ish.responsive

The Responsive instances public API.

Parameters:
Name Type Description
options object
Properties
Name Type Description
breakpoints Array

An Array of Objects where the key is the name of the breakpoint and the value is the value that breakpoint will be triggered.

eventPrefix string

The prefix or namespace events will be called under.

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 140

Removes 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)

line 67
Description:

Add one or more breakpoints to the instance.

Returns
ish.responsive

Chainable, returns its own instance.

Parameters:
Name Type Description
settings Array

An Array containing breakpoint settings.

remove(settings)

line 78
Description:

Remove one or more breakpoint object from the instance.

Returns
ish.responsive

Chainable, returns its own instance.

Parameters:
Name Type Description
settings Array

An Array containing breakpoint settings.