Related to: https://github.com/zurb/foundation-sites/issues/10892
}
// Otherwise, parse toggle class
else {
- input = this.$element.data('toggler');
+ input = this.options.toggler;
+ if (typeof input !== 'string' || !input.length) {
+ throw new Error(`The 'toogler' option containing the target class is required, got "${input}"`);
+ }
// Allow for a . at the beginning of the string
this.className = input[0] === '.' ? input.slice(1) : input;
}
}
Toggler.defaults = {
+ /**
+ * Class of the element to toggle. It can be provided with or without "."
+ * @option
+ * @type {string}
+ */
+ toggler: undefined,
/**
* Tells the plugin if the element should animated when toggled.
* @option