尝试解决 IOS 设备上键盘扰乱固定元素的问题。
当单击 CKEditor 文本区域时,我的目标是将该固定元素的样式设置回固定。
但不确定如何检测正在聚焦的 CKEditor。
我试过的都没有用,这里是基本的:
http://jsfiddle.net/B4yGJ/180/
CKEDITOR.replace('editor1');
$('#editor1').focus(function() {
alert('Focused');
});
最佳答案
CKEditor 有一个自定义的焦点事件,这对你很有用。请在此处查看文档:http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-focus
你可以像这样使用它,例如:
CKEDITOR.on('instanceReady', function(evt) {
var editor = evt.editor;
console.log('The editor named ' + editor.name + ' is now ready');
editor.on('focus', function(e) {
console.log('The editor named ' + e.editor.name + ' is now focused');
});
});
CKEDITOR.replace('editor1');
JSFiddle 在 http://jsfiddle.net/B4yGJ/181/
关于javascript - 检测CKEditor的焦点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25838738/