MS Word像HTML中的DOM操作 [英] MS Word like DOM manipulation in HTML

查看:223
本文介绍了MS Word像HTML中的DOM操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请观看此视频。在MS Word中,可以在任何地方拖动任何元素。基于此,剩余的内容(在这个视频示例中只有文本)回流和包装以适合。例如,当两个图像并排并且一个被拖动或向另一个拖动时,中间的文本相应地缩小或扩展。

Have a look at this video. In MS Word, one can drag any element anywhere. Based on that, the remaining content (only text, in this video example) reflows and wraps to fit. For example, when two images are side by side and one is dragged away or towards the other, the text in between shrinks or expands accordingly.

无论如何可以模仿这样的行为在HTML中,用Javascript?我发现的最大的困难是元素拥有它们在HTML中的内容。因此, span 拥有其文本, div 拥有其文本。但在视频中,我们可以看到在图像之间的文本元素没有完全自己的任何内容,它得到任何适合,而传输文本从左到右。这就是为什么,它的内容随着方向的变化而变化。此外,它的文本不是连续的。它包含多个句子的位和片段。

Is it anyhow possible to mimic such behavior in HTML, with Javascript? The biggest difficulty I find is the fact that elements own their content in HTML. So, a span owns its text, a div owns its text. But in the video, we can see that the text element in between the images hasn't exactly any content of its own, it gets whatever fits into it while transferring text from left to right. That is why, its content changes with change in orientation. Also, its text is not continuous. It contains bits and pieces of multiple sentences.

使用HTML和Javascript可以进行这样的操作吗?

Are such manipulations possible with HTML and Javascript? If so, any heads-up will be nice...

推荐答案

看看css exculsions:

Have a look at css exculsions:

http://adobe.github。 com / web-platform / samples / css-exclusions /

它可能会帮助你达到你想要的效果。请注意,这是一个实验功能。

it might help you acheive what you want. note that it is an experimental feature.

这篇关于MS Word像HTML中的DOM操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆