V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
爱意满满的作品展示区。
droiz

shear.js v2 多行文本截断,更新支持 IE/Edge

  •  
  •   droiz ·
    zhengrenzhe · Aug 10, 2018 · 1844 views
    This topic created in 2830 days ago, the information mentioned may be changed or developed.

    嘻嘻嘻,最近更新了一下,做了对 IE/Edge 的兼容处理,测试可能还有不到位的地方,欢迎提 issue/bug。

    shear.js 是一个基于 Selection API 的多行文本截断库,在原理上与现有的几款(clamp.js, shave.js)不同,这也是 shear.js 的特点:

    • 支持对块级 /行内元素进行正确截断
    • 支持目标元素内含非文本节点,截断后保留节点哪原始 dom 结构

    示例 Codepen

    欢迎使用!!!

    2 replies    2018-08-11 18:33:20 +08:00
    droiz
        1
    droiz  
    OP
       Aug 10, 2018
    https://github.com/zhengrenzhe/shear.js

    居然忘记放 github 链接了。。
    cydian
        2
    cydian  
       Aug 11, 2018 via Android
    Demo 不可用?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3257 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 13:42 · PVG 21:42 · LAX 06:42 · JFK 09:42
    ♥ Do have faith in what you're doing.