加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

javascript – 检测CKEditor的焦点

发布时间:2020-12-14 23:09:54 所属栏目:资源 来源:网络整理
导读:试图解决问题在IOS设备上键盘破坏固定元素. 单击CKEditor文本区域时,我的目标是将该固定元素的样式设置为固定. 但是不确定如何检测CKEditor的焦点. 我没有尝试过任何工作,这里是基本的: http://jsfiddle.net/B4yGJ/180/ CKEDITOR.replace('editor1');$('#ed

试图解决问题在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/年

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读