【问题标题】:How to place a scroll down arrow at the bottom of a button card如何在按钮卡底部放置向下滚动箭头
【发布时间】:2020-09-25 06:50:10
【问题描述】:

我的卡片组件渲染一个按钮,看起来像这样

  const SearchCard = () => (
    <div>
      <a href="#bottomSection" className="scroll-button">
        <img src="images/arrow_down.svg" alt="scroll to bottom" />
      </a>
      <button class="invisible-button" onClick={onSearchCardClick}>
        <img id="search-image" alt={imgAlt} style={cardStyles} src={card.src} />
      </button>
      <div id="bottomSection"></div>
    </div>
  );

#

我在左上角的 x 下方有一个向下箭头,它滚动到底部,首先我希望它位于底部,如下图所示,并且仅在 card.src 比视图长时出现

【问题讨论】:

    标签: javascript html css reactjs


    【解决方案1】:

    您可以通过将其固定在 CSS 中,然后将其置于右下角,将其定位到底部,如下所示:

    .scroll-button {
      position: fixed;
      bottom: 0;
      right: 0;
    }
    

    【讨论】:

    • 向下箭头图像消失
    • @Ada 像这样:.scroll-button { position: fixed; bottom: 10%; right: 10%; } 并不断修改它,直到你把它拿到你想要的地方。
    • 嗯,试试给它添加一个 z-index。就像z-index 99; 看看它是否出现
    • 您还有可以分享的代码吗?或者把它放在一个jsfiddle或什么的?我不确定为什么在没有上下文的情况下这不起作用。
    • 也许 SearchCard 是如何呈现的。我不太确定它是否相关
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-10-08
    • 1970-01-01
    • 2014-02-11
    • 1970-01-01
    • 1970-01-01
    • 2015-04-02
    • 1970-01-01
    相关资源
    最近更新 更多