vendor/assets/javascripts/base/_hoverdown.js in active_frontend-14.0.77 vs vendor/assets/javascripts/base/_hoverdown.js in active_frontend-14.0.78
- old
+ new
@@ -22,10 +22,14 @@
if (!$.fn.dropdown) throw new Error('Hoverdown requires dropdown.js');
Hoverdown.VERSION = '1.0.0';
Hoverdown.DEFAULTS = {
delay: 500,
+ onCloseMenuCallback: function () {},
+ onHoverOutDelayCallback: function () {},
+ onHoverOutTimeoutCallback: function () {},
+ onOpenMenuCallback: function () {},
timeout: 500
};
Hoverdown.prototype.constructor = Hoverdown;
@@ -53,27 +57,33 @@
var _self = this;
this.$timeout = window.setTimeout(function () {
_self.closeMenu();
}, this.options.timeout);
+
+ this.options.onHoverOutTimeoutCallback();
};
Hoverdown.prototype.hoverOutDelay = function () {
var _self = this;
window.setTimeout(function () {
_self.closeMenu();
}, this.options.delay);
+
+ this.options.onHoverOutDelayCallback();
};
Hoverdown.prototype.openMenu = function () {
this.$parent.addClass('open');
this.$dropmenu.trigger('show.bs.dropdown');
+ this.options.onOpenMenuCallback();
};
Hoverdown.prototype.closeMenu = function () {
this.$parent.removeClass('open');
this.$dropmenu.trigger('hide.bs.dropdown');
+ this.options.onCloseMenuCallback();
};
// HOVERDOWN PLUGIN DEFINITION
// ===========================