如何使角度2中的物化固定动作按钮工作

时间:2022-08-23 23:32:41

I am trying to get the FAB from materializeCSS to work but nothing I try is working. Heres my code:

我试图让FAB从materializeCSS工作,但我尝试的任何工作都没有。继承我的代码:

index.html:

index.html的:

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>DevWright Education</title>
  <base href="/">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <script src="http://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha256-/SIrNqv8h6QGKDuNoLGA4iret+kyesCkHGzVUUV0shc=" 
  crossorigin="anonymous"></script>
    <!-- Compiled and minified CSS -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/css/materialize.min.css">

  <!-- Compiled and minified JavaScript -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/js/materialize.js"></script>

  <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body style="background-color: #eceff1;">
  <de-root>
    <img src="assets/images/ripple.gif" alt="">  
  </de-root>
</body>
</html>

new-post-card.component.html:

新的后card.component.html:

<div class="card">
  <div class="card-content">
    <span class="card-title">Post something!</span>
    <!-- Fixed Action Button -->
    <div class="fixed-action-btn horizontal click-to-toggle" style="bottom: 45px; right: 24px;">
      <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>

I've tried using angular2-materialize but i cant find the right component to work with it.

我尝试过使用angular2-materialize,但我找不到合适的组件来使用它。

1 个解决方案

#1


1  

In my case it was because the position on the FAB was fixed, so changing

在我的情况下,这是因为FAB上的位置是固定的,所以改变了

<div class="fixed-action-btn horizontal click-to-toggle" style="bottom: 45px; right: 24px;">

to

<div class="fixed-action-btn horizontal click-to-toggle" style="bottom: 45px; right: 24px; position:static;">

fixed the problem.

解决了这个问题。

#1


1  

In my case it was because the position on the FAB was fixed, so changing

在我的情况下,这是因为FAB上的位置是固定的,所以改变了

<div class="fixed-action-btn horizontal click-to-toggle" style="bottom: 45px; right: 24px;">

to

<div class="fixed-action-btn horizontal click-to-toggle" style="bottom: 45px; right: 24px; position:static;">

fixed the problem.

解决了这个问题。