Questions tagged [simplemodal]

Overview

SimpleModal is a lightweight jQuery plugin which provides a powerful interface for modal dialog development. Think of it as a modal dialog framework. SimpleModal gives you the flexibility to build whatever you can envision, while shielding you from related cross-browser issues inherent with UI development.

Usage

SimpleModal provides two simple ways to invoke a modal dialog.

As a chained jQuery function, you can call the modal() function on a jQuery element and a modal dialog will be displayed using the contents of that element. For example:

$("#element-id").modal();

As a stand-alone function, a modal dialog can be created by passing a jQuery object, a DOM element, or a plain string (which can contain HTML). For example:

$.modal("<div><h1>SimpleModal</h1></div>");

Both of the methods described above, also accept an optional options object (nice tongue-twister, huh?). Using the examples above:

$("#element-id").modal({options});
$.modal("<div><h1>SimpleModal</h1></div>", {options});

Because SimpleModal is more of a modal dialog framework, both of the examples above would create very basic, unstyled, modal dialogs. Styling can be done through external CSS or through properties in the options object. See the Options section below for a detailed list of the available options.

Styling

Styles can be applied through external CSS, the options object, or both. The CSS options for the modal overlay, container, and data elements are: overlayCss, containerCss and dataCss, all which take a key/value object of properties. See the jQuery CSS documentation for details.

SimpleModal handles setting the necessary CSS for displaying the modal dialog. In addition, SimpleModal dynamically centers the modal dialog, unless the position option is used, which takes precedence.

SimpleModal internally defines the following CSS classes: simplemodal-overlay, simplemodal-container, simplemodal-wrap (SimpleModal will automatically set the overflow to auto if the content gets larger than the container), and simplemodal-data.

  • Note: SimpleModal's default closeHTML option declares the modalCloseImg class in order to display an image for closing the dialog. Download the image. Because it is defined in an option, it cannot be styled through the options - an external CSS definition is required:

    #simplemodal-container a.modalCloseImg {
        background:url(/img/x.png) no-repeat; /* Adjust URL as required */
        width:25px;
        height:29px;
        display:inline;
        z-index:3200;
        position:absolute;
        top:-15px;
        right:-18px;
        cursor:pointer;
    }
    

For Internet Explorer 6, you might want to apply the PNG fix:

<!--[if lt IE 7]>
<style type='text/css'>
    #simplemodal-container a.modalCloseImg {
        background:none;
        right:-14px;
        width:22px;
        height:26px;
        filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(
            src='img/x.png', sizingMethod='scale'
        );
    }
</style>
<![endif]-->

Demos

In addition to the examples below, I have a collection of demos that feature the different capabilities of SimpleModal:

View Demos

Download

SimpleModal is hosted on Google Code:

Download SimpleModal

There are two versions available; a full source version that contains comments and is formatted for readability, and a minified version with all comments and formatting removed. The full version is recommended for learning and testing, the minified version is for production use.

Archives

Previous version of SimpleModal documentation: v1.2.x, v1.1.x, v1.0.x.

Source

687 questions
0
votes
1 answer

Selenium IDE and custom confirm() function conflict

I am using simple modal dialog by Eric Martin. And have defined a function e.g function confirm(message, options) {.... } To customize all confirm dialogs. Its working nicely accross all the browsers.Except when I enable Selenium IDE ,my custom…
sakhunzai
  • 13,900
  • 23
  • 98
  • 159
0
votes
3 answers

ERIC MARTIN Simple Modal window close event is not working when i am showing another dialog popup over that....?

I am using simple modal window to show dynamic content(table) on modal window popup. The close event is working fine when I am simply showing data in modal window. But if I am showing another jquery dialog popup on simple modal window after closing…
vips
  • 183
  • 1
  • 5
  • 16
0
votes
2 answers

PHP Post to Simple Modal then Update the page

So what I'm attempting to do is this: User clicks a radio html form button. User clicks a submit button to confirm his choice. SimpleModal pops up and displays the value of the button chosen. User clicks 'Accept' in the SimpleModal and the parent…
Chad Fisher
  • 353
  • 4
  • 16
0
votes
1 answer

Open Sharepoint Application Page inside ASP.Net web app

I have the unusual situation to solve... There is a application page that runs inside SharePoint 2010 with a form to upload some file to a Document Library. The thing is that this application page needs to be showed on a modal inside my ASPX web…
Daniel
  • 455
  • 4
  • 14
0
votes
1 answer

JQuery simplemodal dialog box not closing in IE

I'm working with SimpleModal 1.4.2. In FF and Safari, one can click on the "X" in the corner to close the dialog, but in IE 7, 8, and 9, the "X" is ineffectual. What's frustrating is that I've used SimpleModal on another website, and it's working…
0
votes
1 answer

simplemodal not displaying

I am beyond my knowledge here. It has to be something completely obvious that I am just missing. I'm trying to use a jQuery SimpleModal to display a confirmation that a record was added to the database. I've managed to figure out how to get the…
BigDaddyJay
  • 70
  • 2
  • 6
0
votes
1 answer

jQuery SimpleModal: X different modal contents in the same page

I am making a page with logos and using simple modal to make a popup appear to get more information about the logo clicked. I followed this question/answer correctly and was able to make the 2 first logos work; jQuery SimpleModal: two different…
Jauny
  • 950
  • 1
  • 8
  • 19
0
votes
2 answers

how to re size the simple modal dialog

I am trying to make the ericmmartin simplemodal dialog wider and taller. My requirement is that the dialog will display scroll bars if the content is long, which it does using the out of the box settings. If I alter the css example given :…
Richard
  • 224
  • 1
  • 7
  • 18
0
votes
2 answers

simple model dialog fails work