微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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/

原文地址:https://www.jb51.cc/html/426526.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐