Created
January 16, 2017 11:26
-
-
Save pigeonflight/2ccf1ccfeaee9215fa4bc4fd20a81852 to your computer and use it in GitHub Desktop.
Complete Example of Using Plone Mockups Modal Pattern to open modal on page launch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = setTimeout(function () { | |
document.querySelector("#my-modal .pat-plone-modal").click(); | |
}, 5000); | |
// note the use of #my-modal before .pat-plone-modal this makes the selector specific to the | |
// modal you want, in case there may be other modals on the site. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- custom rule for the modal it places it at the bottom of the site --> | |
<after css:theme-children="body"> | |
<include css:content="#my-modal" | |
href="@@rapido/modal/blocks/modal" /> | |
</after> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- I would locate this file under | |
rapido/modal/blocks/modal.html | |
--> | |
<div id="my-modal"> | |
<a href="#modal1" class="plone-btn plone-btn-large plone-btn-primary pat-plone-modal" | |
data-pat-modal="width: 400;" | |
>Modal basic</a> | |
<div id="modal1" style="display: none"> | |
<h1>Basic modal!</h1> | |
<p>Indeed. Whoa whoa whoa whoa. Wait.</p> | |
</div> | |
<script src="++theme++my-theme/path/to/custom.js?ikd"> </script> | |
<!-- I usually add a unique string after the js file for cache-busting purposes --> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment