我正在尝试扩展引导弹出窗口以在手动模式下退出时关闭。我正在尝试扩展 popover 类继承的工具提示类,如下所示:
/* WHY CANT I CALL the HIDE FUNCTION WHEN ESC key press is intercepted????
Why is the hide class undefined when the keypress is intercetped?
*/
!function ($) {
"use strict"
/* TOOLTIP PUBLIC CLASS DEFINITION
* =============================== */
var Tooltip = function (element, options) {
this.init('tooltip', element, options)
}
Tooltip.prototype = {
constructor: Tooltip
, init: function (type, element, options) {
//init logic here
$(document).keypress(function (e) {
if (e.which == 27) { this.hide };
}); ^^^^^^^^^^^^^
this.hide is undefined on debug????
}
, hide: function () {
//hide logic
}
}