gpt4 book ai didi

html - 我如何使用 Materialise 在垂直 FAB 中拥有水平 FAB?

转载 作者:行者123 更新时间:2023-11-28 00:58:34 29 4
gpt4 key购买 nike

我正在尝试使用 Materialize 在垂直 FAB 内创建水平 FAB。下面的代码几乎可以完美运行,但是每当我将鼠标悬停在主 FAB 上时,它都会切换主 FAB 和第二个 FAB,但我只想在将鼠标悬停在共享按钮上时打开第二个 fab。 (第二个 FAB 按钮)
我正在使用 Materialise 0.100.2。
我还创建了一个 working pen here .

.FAB2 {
position: relative !important;
display: inline-block;
right: 24px !important;
right: 17px !important;
bottom: 0 !important;
padding: 0 0 0 25px !important;
}
.FAB2-li {
margin: 0 15px 0 0 !important;
}
<!DOCTYPE html>
<html>
<head>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">


<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>

<body>
<div class="fixed-action-btn">
<a class="btn-floating btn-large red">
<i class="large material-icons">mode_edit</i>
</a>
<ul>

<li class="fixed-action-btn horizontal FAB2">
<!--Share button-->
<a class="btn-floating red">
<i class="large material-icons">share</i>
</a>
<!--End of share button-->
<ul>
<li class="FAB2-li"><a class="btn-floating red"><i class="material-icons">insert_chart</i></a></li>
<li class="FAB2-li"><a class="btn-floating yellow darken-1"><i class="material-icons">format_quote</i></a></li>
<li class="FAB2-li"><a class="btn-floating green"><i class="material-icons">publish</i></a></li>
<li class="FAB2-li" style="margin-right: 0px !important;"><a class="btn-floating blue"><i class="material-icons">attach_file</i></a></li>
</ul>
</li>

<li><a class="btn-floating red"><i class="material-icons">insert_chart</i></a></li>
<li><a class="btn-floating yellow darken-1"><i class="material-icons">format_quote</i></a></li>
<li><a class="btn-floating green"><i class="material-icons">publish</i></a></li>
<li><a class="btn-floating blue"><i class="material-icons">attach_file</i></a></li>
</ul>
</div>
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>

</body>
</html>

最佳答案

.FAB2 {
position: relative !important;
display: inline-block;
right: 24px !important;
right: 17px !important;
bottom: 0 !important;
padding: 0 0 0 25px !important;
}
.FAB2-li {
margin: 0 15px 0 0 !important;
}
li.fixed-action-btn.horizontal.FAB2>ul {
opacity:0 !important;
transition:0.2s all;
}
li.fixed-action-btn.horizontal.FAB2:hover >ul {
opacity:1 !important;
}
<!DOCTYPE html>
<html>
<head>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">


<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>

<body>
<div class="fixed-action-btn">
<a class="btn-floating btn-large red">
<i class="large material-icons">mode_edit</i>
</a>
<ul>

<li class="fixed-action-btn horizontal FAB2">
<!--Share button-->
<a class="btn-floating red">
<i class="large material-icons">share</i>
</a>
<!--End of share button-->
<ul>
<li class="FAB2-li"><a class="btn-floating red"><i class="material-icons">insert_chart</i></a></li>
<li class="FAB2-li"><a class="btn-floating yellow darken-1"><i class="material-icons">format_quote</i></a></li>
<li class="FAB2-li"><a class="btn-floating green"><i class="material-icons">publish</i></a></li>
<li class="FAB2-li" style="margin-right: 0px !important;"><a class="btn-floating blue"><i class="material-icons">attach_file</i></a></li>
</ul>
</li>

<li><a class="btn-floating red"><i class="material-icons">insert_chart</i></a></li>
<li><a class="btn-floating yellow darken-1"><i class="material-icons">format_quote</i></a></li>
<li><a class="btn-floating green"><i class="material-icons">publish</i></a></li>
<li><a class="btn-floating blue"><i class="material-icons">attach_file</i></a></li>
</ul>
</div>
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>

</body>
</html>

只需在下面添加 css 即可...

li.fixed-action-btn.horizontal.FAB2>ul {
opacity:0 !important;
transition:0.2s all;
}
li.fixed-action-btn.horizontal.FAB2:hover >ul {
opacity:1 !important;
}

关于html - 我如何使用 Materialise 在垂直 FAB 中拥有水平 FAB?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52810768/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com