0
votes

I have been working with foundation 5, the reveal modal does not trigger and I'm totally at a loss.

Here's the modal code

<td>
  <a href="#" data-reveal-id="modal">Delete</a>

  <div id="modal" class="reveal-modal medium" data-reveal>
      <p></p>
      <p>Please confirm</p>
      <a class="button radius">Confirm</a>
      <a class="close-reveal-modal">x</a>
  </div>
</td>

And the order of the scripts is in the right order just before closing the body tag.

<script src="/js/vendor/modernizr.js"></script>
<script src="/js/vendor/jquery.js"></script>
<script src="/js/foundation.min.js"></script>
<script>
    $(document).foundation();
</script>

I have tried to wrap the $(document).foundation(); in $(document).ready(function(){, but nothing is happening. The alert boxes work just fine, so I'm baffled by the problem with reveal modals.

Any help would be appreciated. Thanks.

1
This looks correct, so I don't know what the cause might be. Does your browser console log any errors?Adam Elsodaney
@AdamElsodaney no the console is clean. The exact same codes work in jsfiddle.mirrokle
Do you have your scripts in the proper folder and do you have the proper path of scripts in the source code? I would double check if the scripts are visible for the browser. Another problem shloud be access to your scripts by "file://" in your browser - you can try run some HTTP server and access it through it.Knut Holm
Shouldn't you be including <script src="/js/foundation.reveal.js"></script>Vahi
@Akarienta Thanks for the reply. The page already runs on server, and I assume the paths are correct because I've also used built-in alert boxes in the page which require jquery as well and they work as they should be.mirrokle

1 Answers

-1
votes

The reason this happening, is perhaps because the modal should be the direct child of the "body" element. It should not be part of the "td" element.

I found the answer on this page: http://foundation.zurb.com/forum/posts/20051-foundation-5-reveal-modal-doesnt-open