编程语言
首页 > 编程语言> > javascript – MaterialiseCSS在卡片中心设置水平FAB

javascript – MaterialiseCSS在卡片中心设置水平FAB

作者:互联网

我正在尝试将materialiseCSS的两个不同部分组合在一起.水平FAB和卡片,图片中心的按钮和文字.
this is the result I like to have

但这是一个’a’标签,它有什么限制< a class =“btn-floating halfway-fab wave-effect wave-light red”>< i class =“material-icons”> add< / I&GT&LT / A&GT 我很亲密,但找不到最后一部分. I have this result

我正在使用以下代码:

 $( document ).ready(function(){
        $(".button-collapse").sideNav()
    });
    $('.dropdown-button').dropdown({
            inDuration: 300,
            outDuration: 225,
            constrainWidth: false, // Does not change width of dropdown to that of the activator
            hover: true, // Activate on hover
            gutter: 0, // Spacing from edge
            belowOrigin: false, // Displays dropdown below the button
            alignment: 'left', // Displays dropdown with edge aligned to the left of button
            stopPropagation: false // Stops event propagation
        }
    );
.btn-card-midle{
    transform: scaleY(0.4) scaleX(0.4) translateY(0px) translateX(20px);
    opacity: 0;
}

.btn-holder{
    position: absolute;
    display: inline-block;

}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CMS</title>
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/css/materialize.min.css">
    <link type="text/css" rel="stylesheet" href="css/style.css">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/js/materialize.min.js"></script>
</head>
<body>
<!-- navigatie -->
<nav class="nav-extended">
    <div class="nav-wrapper">
        <a href="#" class="brand-logo ">CMS</a>
        <ul id="nav-mobile" class="right hide-on-med-and-down">
            <li><a><i class="material-icons">settings</i></a></li>
            <li><a><i class="material-icons">close</i></a></li>
        </ul>
    </div>
    <div class="nav-content" id="tab_menu">
        <ul class="tabs tabs-transparent">
            <li class="tab"><a class="active"  href="#test1">Statics</a></li>
            <li class="tab"><a href="#test2">Edit</a></li>
        </ul>
    </div>
</nav>
<main>
    <div id="test1" class="col s12">
</div>
<div id="test2" class="col s12">
    <div class="row">
    <div class="col s12 m3">
        <div class="card">
            <div class="card-image">
                <img src="https://static1.squarespace.com/static/54bff0d3e4b03c2b708fee78/54dce804e4b0208bec0e6939/5554fca4e4b01c8cda5a5d55/1499833385964/log+cabin+exterior.jpg">
                <span class="card-title">Card Title</span>
                <div class="fixed-action-btn btn-holder horizontal">
                    <a class="btn-floating  btn-large red">
                        <i class="large material-icons">mode_edit</i>
                    </a>
                    <ul>
                        <li><a class="btn-floating  btn-card-midle red"><i class="material-icons">insert_chart</i></a></li>
                        <li><a class="btn-floating btn-card-midle yellow darken-1" ><i class="material-icons">format_quote</i></a></li>
                        <li><a class="btn-floating btn-card-midle green"><i class="material-icons">publish</i></a></li>
                        <li><a class="btn-floating btn-card-midle blue" ><i class="material-icons">attach_file</i></a></li>
                    </ul>
                </div>

            </div>
            <div class="card-content">
                <p>I am a very simple card. I am good at containing small bits of information. I am convenient because I require little markup to use effectively.</p>
            </div>
        </div>
    </div>
</div>
    <div class="fixed-action-btn" onclick="$('.tap-target').tapTarget('open');" >
        <a id="menu" class="btn btn-floating btn-large red"><i class="material-icons">plus_one</i></a>
    </div>
    <div class="tap-target-wrapper circle-open "><div class="tap-target grey" data-activates="menu">
        <div class="tap-target-content white-text open-content">
            <h5>I am here</h5>
            <p class="white-text">Provide value and encourage return visits by introducing users to new features and functionality at contextually relevant moments.</p>
        </div>
    </div><div class="tap-target-wave open-btn" ><a class="btn btn-floating btn-large red tap-target-origin"><i class="material-icons">plus_one</i></a></div></div>
</div>
</main>


<script type="text/javascript" src="js/main"></script>
</body>
</html>

解决方法:

不知道为什么其他图标保存在Ul中.但是这段代码可以保持编辑按钮的位置.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CMS</title>
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/css/materialize.min.css">
    <link type="text/css" rel="stylesheet" href="css/style.css">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/js/materialize.min.js"></script>
</head>
<body>
<!-- navigatie -->
<nav class="nav-extended">
    <div class="nav-wrapper">
        <a href="#" class="brand-logo ">CMS</a>
        <ul id="nav-mobile" class="right hide-on-med-and-down">
            <li><a><i class="material-icons">settings</i></a></li>
            <li><a><i class="material-icons">close</i></a></li>
        </ul>
    </div>
    <div class="nav-content" id="tab_menu">
        <ul class="tabs tabs-transparent">
            <li class="tab"><a class="active"  href="#test1">Statics</a></li>
            <li class="tab"><a href="#test2">Edit</a></li>
        </ul>
    </div>
</nav>
<main>
    <div id="test1" class="col s12">
</div>
<div id="test2" class="col s12">
    <div class="row">
    <div class="col s12 m3">
        <div class="card">
            <div class="card-image">
                <img src="https://static1.squarespace.com/static/54bff0d3e4b03c2b708fee78/54dce804e4b0208bec0e6939/5554fca4e4b01c8cda5a5d55/1499833385964/log+cabin+exterior.jpg">
                <span class="card-title">Card Title</span>
              
            </div>
<div class="card-action" style="padding:0px">
             
           
<div class="fixed-action-btn horizontal" style="position:relative; float:right; bottom:35px; right:10px">
    <a class="btn-floating btn-large red">
      <i class="large material-icons">mode_edit</i>
    </a>
    <ul>
      <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>
 </div>
            <div class="card-content">
                <p>I am a very simple card. I am good at containing small bits of information. I am convenient because I require little markup to use effectively.</p>
            </div>
        </div>
    </div>
</div>
    <div class="fixed-action-btn" onclick="$('.tap-target').tapTarget('open');" >
        <a id="menu" class="btn btn-floating btn-large red"><i class="material-icons">plus_one</i></a>
    </div>
    <div class="tap-target-wrapper circle-open "><div class="tap-target grey" data-activates="menu">
        <div class="tap-target-content white-text open-content">
            <h5>I am here</h5>
            <p class="white-text">Provide value and encourage return visits by introducing users to new features and functionality at contextually relevant moments.</p>
        </div>
    </div><div class="tap-target-wave open-btn" ><a class="btn btn-floating btn-large red tap-target-origin"><i class="material-icons">plus_one</i></a></div></div>
</div>
</main>


<script type="text/javascript" src="js/main"></script>
</body>
</html>

标签:javascript,html5,css3,materialize
来源: https://codeday.me/bug/20190701/1349364.html