diff --git a/app/assets/javascripts/calendar.js b/app/assets/javascripts/calendar.js index 45f44ad..7c51dfa 100644 --- a/app/assets/javascripts/calendar.js +++ b/app/assets/javascripts/calendar.js @@ -690,7 +690,12 @@ var EventDialog = function(calendar,event){ } } - + this.esc_keydown = function(e){ + var code = e.keyCode || e.which; + if( code ==27 ){ + _t.hide(); + } + } this.show = function(pos){ event_quick_view.css({display: 'inline-block',width: '',height: '', position: "fixed", "z-index": "10000"}); var offset; @@ -698,7 +703,7 @@ var EventDialog = function(calendar,event){ if(pos){ offset = {"left":pos.x,"top":pos.y}; var pos = getPosition(pos); - event_quick_view.offset(offset); + event_quick_view.css(offset); }else{ offset = {"left": padding, "top": padding}; } @@ -767,10 +772,12 @@ var EventDialog = function(calendar,event){ need_redisplay = true; } if(need_redisplay){ - event_quick_view.offset(new_offset); + event_quick_view.css(new_offset); event_quick_view.width(new_width); event_quick_view.height(new_height); } + $(document).off("keydown", _t.esc_keydown); + $(document).on("keydown", _t.esc_keydown); } this.hide = function(){ calendar.calendar_dom.find('.fc-popover-close').click(); diff --git a/app/assets/javascripts/calendar_frontend.js b/app/assets/javascripts/calendar_frontend.js index eaee7fd..445cdcc 100644 --- a/app/assets/javascripts/calendar_frontend.js +++ b/app/assets/javascripts/calendar_frontend.js @@ -486,7 +486,12 @@ var EventDialog = function(calendar,event){ ''; } - + this.esc_keydown = function(e){ + var code = e.keyCode || e.which; + if( code ==27 ){ + _t.hide(); + } + } this.show = function(pos){ event_quick_view.css({display: 'inline-block',width: '',height: '', position: "fixed", "z-index": "10000"}); var offset; @@ -494,7 +499,7 @@ var EventDialog = function(calendar,event){ if(pos){ offset = {"left":pos.x,"top":pos.y}; var pos = getPosition(pos); - event_quick_view.offset(offset); + event_quick_view.css(offset); }else{ offset = {"left": padding, "top": padding}; } @@ -529,10 +534,12 @@ var EventDialog = function(calendar,event){ need_redisplay = true; } if(need_redisplay){ - event_quick_view.offset(new_offset); + event_quick_view.css(new_offset); event_quick_view.width(new_width); event_quick_view.height(new_height); } + $(document).off("keydown", _t.esc_keydown); + $(document).on("keydown", _t.esc_keydown); } this.hide = function(){ calendar.calendar_dom.find('.fc-popover-close').click();