Reputation: 2248
I am working on creating my first jQuery based plugin but I am stuck at an issue.
I receive an error stating var minHeight is undefined when I am trying to console.log it.
(function ($) {
$.fn.ezToggle = function (options) {
var defaults = {
selector: $('.selector'),
minHeight: defaults.selector.height(),
speed: 200
}
console.log(defaults.minHeight); // appears undefined
};
})(jQuery);
Upvotes: 0
Views: 165
Reputation: 487
Use the selector in attribute minHeight too:
minHeight: $('.selector').height();
Upvotes: 1