为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

喵喔喔 2024-01-11 14:16:05
我正在设计一个页面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;}提前致谢。
查看完整描述

1 回答

?
慕斯709654

TA贡献1840条经验 获得超5个赞

为按钮提供 z-index,使其位于页脚顶部。

.chat-icon-btn {
  z-index: 999;
}


查看完整回答
反对 回复 2024-01-11
  • 1 回答
  • 0 关注
  • 25 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信