gemini-accordion
Advanced tools
Comparing version 1.0.2 to 1.1.0
# CHANGELOG | ||
## v1.1.0 | ||
- Add option to pass a callback to the accordion open and close events | ||
- Update linting of Gruntfile | ||
## v1.0.2 | ||
@@ -4,0 +9,0 @@ |
@@ -77,3 +77,39 @@ /** | ||
*/ | ||
anchor: '.accordion__title' | ||
anchor: '.accordion__title', | ||
/** | ||
* The class added to open accordions | ||
* | ||
* @name gemini.accordion#activeClass | ||
* @type string | ||
* @default 'is-active' | ||
*/ | ||
activeClass: 'is-active', | ||
/** | ||
* A class used to disable accordions | ||
* | ||
* @name gemini.accordion#disableClass | ||
* @type string | ||
* @default 'is-inactive' | ||
*/ | ||
disableClass: 'is-inactive', | ||
/** | ||
* A callback to be called when the accordion opens | ||
* | ||
* @name gemini.accordion#onOpen | ||
* @type function | ||
* @default false | ||
*/ | ||
onOpen: false, | ||
/** | ||
* A callback to be called when the accordion closes | ||
* | ||
* @name gemini.accordion#onClose | ||
* @type function | ||
* @default false | ||
*/ | ||
onClose: false | ||
}, | ||
@@ -102,5 +138,42 @@ | ||
if ( !plugin.$el.hasClass( 'is-inactive' )) { | ||
plugin.$el.toggleClass( 'is-active' ); | ||
if ( !plugin.$el.hasClass( plugin.settings.disableClass )) { | ||
if ( !plugin.$el.hasClass( plugin.settings.activeClass )) { | ||
plugin._open(); | ||
} else { | ||
plugin._close(); | ||
} | ||
} | ||
}, | ||
/** | ||
* Function used to open the accordion and call the provided callback | ||
* | ||
* @private | ||
* @name gemini.accordion#_open | ||
* @function | ||
**/ | ||
_open: function() { | ||
var plugin = this; | ||
plugin.$el.addClass( plugin.settings.activeClass ); | ||
if ( plugin.settings.onOpen ) { | ||
plugin.settings.onOpen.call( plugin ); | ||
} | ||
}, | ||
/** | ||
* Function used to close the accordion and call the provided callback | ||
* | ||
* @private | ||
* @name gemini.accordion#_close | ||
* @function | ||
**/ | ||
_close: function() { | ||
var plugin = this; | ||
plugin.$el.removeClass( plugin.settings.activeClass ); | ||
if ( plugin.settings.onClose ) { | ||
plugin.settings.onClose.call( plugin ); | ||
} | ||
} | ||
@@ -107,0 +180,0 @@ }); |
@@ -12,3 +12,3 @@ 'use strict'; | ||
// Metadata. | ||
pkg : grunt.file.readJSON( 'package.json' ), | ||
pkg: grunt.file.readJSON( 'package.json' ), | ||
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + | ||
@@ -24,4 +24,4 @@ '<%= grunt.template.today("yyyy-mm-dd") %>\n' + | ||
timeout: 10000, | ||
urls : [ 'http://localhost:9000/test/<%= pkg.name %>.html' ], | ||
page : { | ||
urls: [ 'http://localhost:9000/test/<%= pkg.name %>.html' ], | ||
page: { | ||
viewportSize: { width: 10000, height: 10000 } | ||
@@ -42,3 +42,3 @@ } | ||
hostname: '*', | ||
port : 9000 | ||
port: 9000 | ||
} | ||
@@ -50,3 +50,3 @@ } | ||
sassDir: 'test', | ||
cssDir : 'test' | ||
cssDir: 'test' | ||
}, | ||
@@ -62,4 +62,4 @@ dist: { | ||
options: { | ||
urls : [ 'http://localhost:9000/test/<%= pkg.name %>.html' ], | ||
build : process.env.TRAVIS_JOB_ID, | ||
urls: [ 'http://localhost:9000/test/<%= pkg.name %>.html' ], | ||
build: process.env.TRAVIS_JOB_ID, | ||
browsers: [ | ||
@@ -69,9 +69,9 @@ // iOS | ||
browserName: 'iphone', | ||
platform : 'OS X 10.9', | ||
version : '7.1' | ||
platform: 'OS X 10.9', | ||
version: '7.1' | ||
}, | ||
{ | ||
browserName: 'ipad', | ||
platform : 'OS X 10.9', | ||
version : '7.1' | ||
platform: 'OS X 10.9', | ||
version: '7.1' | ||
}, | ||
@@ -81,4 +81,4 @@ // Android | ||
browserName: 'android', | ||
platform : 'Linux', | ||
version : '4.3' | ||
platform: 'Linux', | ||
version: '4.3' | ||
}, | ||
@@ -88,14 +88,14 @@ // OS X | ||
browserName: 'safari', | ||
platform : 'OS X 10.9', | ||
version : '7' | ||
platform: 'OS X 10.9', | ||
version: '7' | ||
}, | ||
{ | ||
browserName: 'safari', | ||
platform : 'OS X 10.8', | ||
version : '6' | ||
platform: 'OS X 10.8', | ||
version: '6' | ||
}, | ||
{ | ||
browserName: 'firefox', | ||
platform : 'OS X 10.9', | ||
version : '28' | ||
platform: 'OS X 10.9', | ||
version: '28' | ||
}, | ||
@@ -105,39 +105,39 @@ // Windows | ||
browserName: 'internet explorer', | ||
platform : 'Windows 8.1', | ||
version : '11' | ||
platform: 'Windows 8.1', | ||
version: '11' | ||
}, | ||
{ | ||
browserName: 'internet explorer', | ||
platform : 'Windows 8', | ||
version : '10' | ||
platform: 'Windows 8', | ||
version: '10' | ||
}, | ||
{ | ||
browserName: 'internet explorer', | ||
platform : 'Windows 7', | ||
version : '11' | ||
platform: 'Windows 7', | ||
version: '11' | ||
}, | ||
{ | ||
browserName: 'internet explorer', | ||
platform : 'Windows 7', | ||
version : '10' | ||
platform: 'Windows 7', | ||
version: '10' | ||
}, | ||
{ | ||
browserName: 'internet explorer', | ||
platform : 'Windows 7', | ||
version : '9' | ||
platform: 'Windows 7', | ||
version: '9' | ||
}, | ||
{ | ||
browserName: 'internet explorer', | ||
platform : 'Windows 7', | ||
version : '8' | ||
platform: 'Windows 7', | ||
version: '8' | ||
}, | ||
{ | ||
browserName: 'firefox', | ||
platform : 'Windows 7', | ||
version : '29' | ||
platform: 'Windows 7', | ||
version: '29' | ||
}, | ||
{ | ||
browserName: 'chrome', | ||
platform : 'Windows 7', | ||
version : '34' | ||
platform: 'Windows 7', | ||
version: '34' | ||
}, | ||
@@ -147,4 +147,4 @@ // Linux | ||
browserName: 'firefox', | ||
platform : 'Linux', | ||
version : '29' | ||
platform: 'Linux', | ||
version: '29' | ||
} | ||
@@ -151,0 +151,0 @@ ] |
{ | ||
"name": "gemini-accordion", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Gemini Accordion", | ||
@@ -10,2 +10,5 @@ "author": { | ||
}, | ||
"contributors": [ | ||
"Jeff Andrews <jeff.andrews@carpages.ca>" | ||
], | ||
"main": "gemini.accordion.js", | ||
@@ -12,0 +15,0 @@ "repository": { |
14814
345