模态窗口似乎不起作用

时间:2017-07-08 12:09:55

标签: javascript jquery css materialize

尝试在Lyric按钮上集成模态窗口:https://soundwhore.com/trance/tenishia-feat-adina-butar-dont-let-go/

然而,点击没有任何反应。任何想法,为什么这不起作用?

代码在这里:

<p class="meta-data">
  <a class="waves-effect waves-light btn-large red" href="#modal-lyric">
    <i class="material-icons left">subject</i>Lyrics
  </a>
  <a class="waves-effect waves-light btn-large amber accent-4" href="https://itunes.apple.com/us/album/dont-let-go-feat.-adina-butar/id1054325261?i=1054325265" target="_blank" title="Go to https://itunes.apple.com/us/album/dont-let-go-feat.-adina-butar/id1054325261?i=1054325265">
    <i class="material-icons left">shopping_cart</i>Buy now
  </a>
</p>
<div class="modal" id="modal-lyric">
  <div class="modal-content">
    <h4>Lyrics</h4>
    <p></p>
  </div>
  <div class="modal-footer">
    <a class="modal-action modal-close waves-effect waves-green btn-flat" href="#!">Done</a>
  </div>
</div>

来源:http://materializecss.com/modals.html

1 个答案:

答案 0 :(得分:0)

我想你只是忘了添加监听器:

  <script>
    $(document).ready(function() {
      $(".modal").modal()
    });
  </script>