[英]Floating Action Button Text to the Side
I have been trying to add labels to the left of my FAB. 我一直在尝试在我的FAB左侧添加标签。 I am liking the Material Design, but I am having an issue on getting the labels to appear properly.
我喜欢Material Design,但我遇到了让标签正确显示的问题。 Any tips would be appreciated.
任何提示将不胜感激。 Everything is displaying correctly except adding labels.
除了添加标签外,一切都正常显示。
Here is a working example: http://codepen.io/petja/pen/OVRYMq 这是一个工作示例: http : //codepen.io/petja/pen/OVRYMq
HTML HTML
<div class="backdrop"></div>
<div class="fab child" data-subitem="1">
<a href="tel:+121212121"><img alt="" src="images/smile.jpg"></a>
</div>
<div class="fab child" data-subitem="2">
<a href="tel:+1212121212"><img alt="" src="about/smile.jpg"></a>
</div>
<div class="fab visible-xs float-phone" id="masterfab">
<i class="fa icon-phone soft-white"></i>
</div>
CSS CSS
.fab {
background: #1C9E00;
border-radius: 50%;
text-align: center;
color: #FFF;
position: fixed;
right: 70px;
font-size: 25px;
padding: 9px 2.5px 6px;
-webkit-filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .42));
}
.fab span {
vertical-align: middle;
}
.fab.child {
width: 53.666667px;
height: 37.666667px;
display: none;
opacity: 0;
background: transparent;
border-radius: 0%;
right: 63px;
padding: 0;
}
.fab img {
border-radius: 50%;
}
.backdrop {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #FAFAFA;
opacity: 0.7;
display: none;
}
JS JS
$(function(){
$(".fab,.backdrop").click(function(){
if($(".backdrop").is(":visible")){
$(".backdrop").fadeOut(125);
$(".fab.child")
.stop()
.animate({
bottom : $("#masterfab").css("bottom"),
opacity : 0
},125,function(){
$(this).hide();
});
}else{
$(".backdrop").fadeIn(125);
$(".fab.child").each(function(){
$(this)
.stop()
.show()
.animate({
bottom : (parseInt($("#masterfab").css("bottom")) + parseInt($("#masterfab").outerHeight()) + 70 * $(this).data("subitem") - $(".fab.child").outerHeight()) + "px",
opacity : 1
},125);
});
}
});
});
You want something like this? 你想要这样的东西吗?
There is .backdrop
class in your css So, when I try to add materialize tooltipped it has same class name .backdrop
which responsible to change background color of tooltip. 你的css中有
.backdrop
类所以,当我尝试添加materialize工具提示时,它有相同的类名.backdrop
,它负责改变工具提示的背景颜色。
You added background: #ECECEC;
你添加了
background: #ECECEC;
in .backdrop
So, tooltips had also same background color
. 在
.backdrop
所以,工具提示也有相同的background color
。 So, I changed your .backdrop
to .backdrop_gray
and Now everything is fine. 所以,我把你的
.backdrop
了.backdrop_gray
,现在一切都很好。
HTML HTML
<div class="backdrop_gray"></div>
<div class="tooltipped fab child" data-position="left" data-delay="50" data-tooltip="I am C" data-subitem="1"><span>C</span></div>
<div class="tooltipped fab child" data-position="left" data-delay="50" data-tooltip="I am B" data-subitem="2"><span>B</span></div>
<div class="tooltipped fab child" data-position="left" data-delay="50" data-tooltip="I am A" data-subitem="3"><span>A</span></div>
<div class="fab" id="masterfab"><span>+</span></div>
<h1>Floating Action Button</h1>
<p>(Hint: Button interacts with you)</p>
JS JS
$('.tooltipped').tooltip({delay: 50});
... // Your other JS.
Check out this github issue 看看这个github问题
Github user philipraets created a nice codepen to demonstrate his soluton. Github用户philipraets创建了一个很好的codepen来演示他的解决方案。
Edit (For the Lazy) : 编辑(懒惰) :
philipraets created a simple css style: philipraets创建了一个简单的CSS样式:
.mobile-fab-tip {
position: fixed;
right: 85px;
padding:0px 0.5rem;
text-align: right;
background-color: #323232;
border-radius: 2px;
color: #FFF;
width:auto;
}
then wrapped the tooltip within another link element using that style: 然后使用该样式将工具提示包装在另一个链接元素中:
<div class="fixed-action-btn click-to-toggle" style="bottom:24px; right:24px;">
<a class="btn-floating btn-large red"><i class="large material-icons">settings</i></a>
<ul>
<li>
<a href="#" class="btn-floating amber darken-1"><i class="material-icons">create</i></a>
<a href="#" class="btn-floating mobile-fab-tip">Edit</a> <!--tooltip-->
</li>
<li>
<a href="#" class="btn-floating blue"><i class="material-icons">event</i></a>
<a href="#" class="btn-floating mobile-fab-tip">Save to calendar</a> <!--tooltip-->
</li>
<li>
<a href="#" class="btn-floating red modal-trigger"><i class="material-icons">supervisor_account</i></a>
<a href="#" class="btn-floating mobile-fab-tip modal-trigger">Switch responsible</a> <!--tooltip-->
</li>
</ul>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.