浮动操作按钮隐藏在页脚后面

我正在设计一个页面angular-material,我想在屏幕右下角添加一个聊天按钮,当我向下滚动页面时,这个按钮应该滚动,就像这个网站一样:http ://harleytherapy.com/

我已经完成了大部分部分,即按钮位于右下角,当我开始滚动页面时,它也会随页面滚动,但唯一的问题是,当我到达底部时,该按钮位于页脚后面并变得不可见。当我到达底部时,我希望它保持在页脚上方。这是我的代码:

<div class="main-content-container">


    <button mat-fab class="chat-icon-btn">

        <mat-icon class="chat-icon">chat_bubble_outline</mat-icon>

    </button>


    <h1>Dashboard&nbsp;<mat-icon aria-label="false">dashboard</mat-icon>

    </h1>

    <!-- Some more content -->



    <footer class="footer">

        <span>

          <a href="#" class="footer-links">Hjem</a><span class="vertical-divider"></span>

          <a href="#" class="footer-links">Om </a> <span class="vertical-divider"></span>

          <a href="#" class="footer-links"> Hjælp </a> <span class="vertical-divider"></span>

          <a href="#" class="footer-links"> Kontakt os </a> <span class="vertical-divider"></span>

          <a href="#" class="footer-links"> Webstedsbetingelser </a> <span class="vertical-divider"></span>

          <a href="#" class="footer-links"> Fortrolighedspolitik</a>

        </span>

      </footer>


</div>

CSS:


.main-content-container {

    margin-left: 10%;

}


.chat-icon-btn {

    position: fixed;

    right: 0;

    bottom: 0;

    background: #3900B3;

    color: #fff;

    font-size: 25px;

    margin-right: 25px;

    margin-bottom: 5px;

}


.chat-icon {

    margin-right: 0px !important;

}


.footer {

    background-color: #3900B3;

    padding: 50px 0 50px 0;

    position: relative;

    text-align: center;

    margin-top: 100px;

}


.footer-links {

    color: #fff;

    text-decoration: navajowhite;

    font-size: 18px;

}

提前致谢。


喵喔喔
浏览 30回答 1
1回答

慕斯709654

为按钮提供 z-index,使其位于页脚顶部。.chat-icon-btn&nbsp;{ &nbsp;&nbsp;z-index:&nbsp;999; }
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Html5