0

I have multiple reveal modals on the page and I trying to display the dynamic custom post type content on each modal when clicked, but the modal keeps repeating the same content on all the modals.

I am trying to initiate new modal on every click so the content doesn't repeat but for some reason it's just not working. If I remove Reveal Modal, then can view the dynamic content. Am I initiating the reveal modal properly? I am not seeing any errors on the console.

Here's my code:

<a class="modal" data-open="exampleModal">Reveal Button</a>

<div class="reveal large" id="exampleModal" data-reveal>
  <!-- content -->
  <button class="close-button" data-close aria-label="Close reveal" type="button">
    <span aria-hidden="true">&times;</span>
  </button>
</div>

<script>
  jQuery(function($) {
    var modal = $('#exampleModal');
    $('a.modal').click(function() {
      var reveal = new Foundation.Reveal(modal);
    });
  });
</script>

Can someone help please. Thanks in advance.

1
  • 1
    I'm not seeing anything related to WordPress in your code block, is Foundation Reveal Modal a javascript library? Or part of a plugin? Is your code block incomplete? Note that if your question requires Foundation specific help then this isn't the place to ask
    – Tom J Nowell
    Aug 22 at 12:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.