javascript – 检测CKEditor的焦点

试图解决问题在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');

JSfiddlehttp://jsfiddle.net/B4yGJ/181/

相关文章

vue阻止冒泡事件 阻止点击事件的执行 <div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些