html - CSS 过渡不适用于 Show-More

标签 html css reactjs next.js

我正在使用 Next.js 应用程序,它有一个带有阅读更多链接的卡片组件。当用户点击阅读更多链接时,卡片应该展开,我使用了“react-show-more”https://github.com/One-com/react-show-more .当按下带有 CSS 转换规则的阅读更多链接但 CSS 转换不起作用时,我需要向卡片添加平滑扩展。这是我的卡片组件。你可以在这里找到现场演示:https://codesandbox.io/s/confident-http-cfz7p?fontsize=14

 return (
    <CardOuter>
      <CardIcon>
        <img className="CardIcons" alt="cardIcon" src={Icon} />
      </CardIcon>
      <CardContent>
        <h3>{Title}</h3>
        <ShowMore
          lines={5}
          more={<Link className="link-right" Content="Read More" />}
          less={<Link className="link-right-sl" Content="Show less" />}
          anchorClass="showMore"
        >
          {Description}
        </ShowMore>
      </CardContent>
    </CardOuter>
  );

最佳答案

我发现了另一个 npm 可以平滑展开,

https://github.com/tinacious/react-animated-show-more

关于html - CSS 过渡不适用于 Show-More,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56454210/

相关文章:

jquery - 慢慢改变带有背景颜色的div的内容

jquery - 在一页上显示多个依赖的Python模型

javascript - 如何在javascript中自动提交表单?

javascript - 水平对齐无序列表 HTML

reactjs - 将 Jest 与 react-scripts 一起使用(通过 yarn 运行),如何在不必传递 watchAll 标志的情况下获得完整的覆盖率报告?

javascript - 构建连接到 SQL Server 的 Web 应用程序的步骤

javascript - div重叠另一个虽然div的位置是相对的

html - 淡出文本颜色(纯 css)

css - 条件 Prop 内的样式化组件 Prop

android - 是否可以从 React App 访问 NFC 功能