Modal Windows

Mura CMS has several useful development tools baked-in. This exercise will demonstrate how to leverage some of those utility functions to create modal windows.

Sometimes you may have a need to display content or other objects within a modal window. The following methods are simple examples of how you can quickly and easily create modal windows with Mura CMS.


The MuraBootstrap theme includes its own method of creating modal windows. The footer.cfm file includes the following code:

It simply includes the file located at /{SiteID}/includes/themes/MuraBootstrap/display_objects/sampleModalWindow.cfm.

Open the file and review it. This simply uses Bootstrap-specific markup to create a modal window. However, for Bootstrap to recognize this window and when to launch it, you need to provide a link with the href attribute pointing to the ID attribute of the modal window container and a data-toggle attribute set to modal. For example, the following line of code can be found in the footer.cfm file:


Shadowbox.js (, a web-based media viewer application, is also automatically included with Mura. In the exercise, we'll use it to display content in a hidden <div> that's been added to the footer.cfm file.

  1. Add the built-in Mura method to the file.
    1. Edit your footer.cfm file and add the following method at the top. This will check to see if the JavaScript for Shadowbox.js has been loaded. If it has, it won't add it again. But if it doesn't yet exist, it will load it for you.

  2. Add the necessary markup.
    1. Next you need to tell Shadowbox which links you want it to open. The simplest way to do this is through your HTML markup. If you're going to take this route, at the very least, you must add a rel="shadowbox" attribute to each link. For example, say you have a link to an image on your page:

      <a href="myimage.jpg">My Image</a>

      In order to set up this link for use with Shadowbox, simply change it to this:

      <a href="myimage.jpg" rel="shadowbox">My Image<a>

      Then, clicking on this link should now open up the image in Shadowbox.

    2. Add the following code to footer.cfm:

    3. Add the following code as the last list item of the unordered list inside the <footer> element. The double pound signs (##) are used to escape CFML rendering.

    4. View your content.

    5. By default, Shadowbox nearly fills the entire viewport. You can control several properties of a Shadowbox content object. A couple of those properties include width and height. Edit the list item we added earlier to include these properties:

    6. Then view your content again: