1

I've been looking everywhere, I'm trying to create a modal using a global but I can't seem to figure out where to start.

JavaScript:

$popUp = new Garnish.Modal($('#popUpModal('),
$popUp.show(),
$popUp.hide()

    (document).ready(function(){
       setTimeout(function(){
         popUp();
      },3000);
  })
);

Twig:

{% set popUpModal = popUpModal.popUpModalContent %}
{% if popUpModal %}
<div class="popUp popUp__popUp-content " id="popUpModal">
    <div id="popUp">
        {{ popUpModal }}
    </div>
</div>
{% endif %}
1
  • 1
    Are you trying to do this in the Craft control panel or on the front end? Garnish is only intended to be used in the CP... Jan 13, 2021 at 17:03

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.