Opening a Modal

Modals can be triggered to open in many ways. The default is to add a unique CSS class to any element.

Using CSS Classes

You can open any modal by adding a class of eModal-# where # is either the unique ID # for your modal in the modal editor, or the unique id you gave your modal with a shortcode or template.

All elements with class of eModal-1 will when clicked open the modal with ID 1.

Using JavaScript

If your in need of a customized opening then JS is the way to go. The following is a template for customization. Without modification this will simply duplicate the default functionality supplied by adding a class.

jQuery(‘.eModal-1’).click(function(e){
e.preventDefault(); // Prevent the default click functionality of the plugin.
// Do something awesome here. Change the content of the modal, add delays etc.
jQuery(‘#eModal-1’).emodal(‘open’); // Call the open command on your modal to show it.
});

Auto Open

Available only for pro users, auto open modals allow you to easily pop up marketing materials, opt-in forms and anything else in a modal automatically after the page loads, without user interaction.

You can enable this option both sitewide via the General Settings page, or on a per page/post basis. If you have it enabled sitewide and then enable a different modal on a specific page, the per page/post settings will override the sitewide settings.

Auto Open settings include choosing the modal to be opened, setting the delay time before the modal is displayed, and the length of time the cookie will be set for, preventing the modal from loading again.

The cookie time is set using plain english such as “4 months 2 days 1 hour 12 minutes” This will set a cookie that will expire in 4 months, 2days, 1 hour and 12 minutes from the time the modal opened.

Open on Exit Detection

Available only for pro users, auto exit modals use “Soft Exit Detection” to load a modal when it thinks the users is about to leave the page. Soft Exit Detection basically detects if a users mouse exits the body of your website at the top. Generally speaking this is because they are either clicking the back button, entering another url or closing the browser. This will trigger your exit modal to load immediately.

You can enable this option both sitewide via the General Settings page, or on a per page/post basis. If you have it enabled sitewide and then enable a different modal on a specific page, the per page/post settings will override the sitewide settings.

Auto Exit settings include choosing the modal to be opened and the length of time the cookie will be set for, preventing the modal from loading again.

The cookie time is set using plain english such as “4 months 2 days 1 hour 12 minutes” This will set a cookie that will expire in 4 months, 2days, 1 hour and 12 minutes from the time the modal opened.[edd_social_discount]