热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

在包含图像的div内的向下箭头键光标-Ondownarrowkeycursorgoinginsideadivcontainingimage

IammodifyingbootstrapbasedHTMLeditor.Ihavedoneimageuploadingpart.Inimageuploading,Ia

I am modifying bootstrap based HTML editor. I have done image uploading part.In image uploading, I am creating an image inside a div.

我正在修改基于bootstrap的HTML编辑器。我已经完成了图像上传部分。在图像上传中,我在div中创建了一个图像。

I want image to be resizeable hence,

我希望图像可以调整大小,因此,

element.style {
   border: 1px solid;
   padding: 10px;
   width: 300px;
   resize: both;
   overflow: auto;
  }

But the issue is when I am hitting a down key cursor is going inside a div containing an image (instead of below a div).

但问题是当我按下一个向下键的光标进入包含图像的div(而不是在div下面)时。

so what changes should I do in order to bring cursor below a div on pressing key down?

那么我应该做什么改变才能在按下键的同时将光标移到div下面?

2 个解决方案

#1


1  

Demo: http://jsfiddle.net/u37cxxbh/2/

演示:http://jsfiddle.net/u37cxxbh/2/

Make div cOntenteditable="false" and add textarea element next to image. As in example above.

使div cOntenteditable=“false”并在图像旁边添加textarea元素。如上例所示。

#2


1  

Simply adding

简单地添加

cOntenteditable="false"

to the div containing the image seems to solve the problem.

包含图像的div似乎解决了问题。

#editor {
  overflow: scroll;
  max-height: 250px;
  height: 250px;
  background-color: white;
  border-collapse: separate;
  border: 1px solid rgb(204, 204, 204);
  padding: 4px;
  box-sizing: content-box;
  -webkit-box-shadow: rgba(0, 0, 0, 0.0745098) 0px 1px 1px 0px inset;
  box-shadow: rgba(0, 0, 0, 0.0745098) 0px 1px 1px 0px inset;
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
  border-bottom-left-radius: 3px;
  border-top-left-radius: 3px;
  overflow: scroll;
  outline: none;
}
div {
  display: block;
}
First line
//after clicking down arrow key cursor going inside an image div

Last line


推荐阅读
author-avatar
手机用户2602883245
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有