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
2 answers

How to return a variable in SimpleModal after closing it

This seems like it would be a pretty wide-spread use for simplemodal but I cannot find how to do it anywhere. I am pulling up a page via iframe using simplemodal, generating a variable, then I would like to pass it back to the parent page when the…
RandyLahey
  • 979
  • 4
  • 10
  • 26
0
votes
1 answer

How to create multiple overlays with Simple Modal?

Trying to create multiple overlays using Simple Modal. Looked through the doc's as well as several other post on Stack and been unsuccessful in doing so. Hopefully more experience jQuery developers can chime in and help. HTML:
alyus
  • 987
  • 4
  • 20
  • 39
0
votes
1 answer

SimpleModal not working in IE7

So, I've got SimpleModal working like I want it to except in IE7. What's the problem? It just doesn't show up at all. I have two types of modals going on. First one: $('.calendar-button').click(function (e) { …
Dennis
  • 47
  • 1
  • 8
0
votes
1 answer

Inserting Variable into DIV within a Javascript Function

Just to put it out there if I say the wrong lingo, I have literally less than 4 hours experience in Javascript for starters. What I am trying to do is add a variable to the end of a predefined DIV that is in javascript. For example here is the…
Justin Lucas
  • 319
  • 2
  • 18
0
votes
1 answer

SimpleModal (jQuery) loses CSS formatting when called by Javascript

I need to call a SimpleModal dialog from Javascript ... I am referring to the downloadable "Confirm Override" demo on http://www.ericmmartin.com/projects/simplemodal-demos/ If I use ...
0
votes
1 answer

Bizarre SimpleMODAL OSX actions in Foreach Loop

I am developing on a Wordpress MU website with a PHPBB3 forum that is merged into the site. On the website there is a page that utilizes SimpleModal OSX Style Modal Dialog that queries some of the website users data. I am also using a plugin that…
Justin Lucas
  • 319
  • 2
  • 18
0
votes
1 answer

Multiple SimpleModals on one page

Newbie question I think, but maybe not... I am using SimpleModal for a project, and have a case where there are multiple triggers and modals on a page. Page is here: http://lumetta.highchairdesign.com/newsite/lumenate-portfolio/linen Markup for the…
J. Hogue
  • 314
  • 4
  • 11
0
votes
1 answer

Popup window on youtube api event

I'm using simplemodal to popup a modal window. I've tested the modal window functionality and it is all working fine. I have a hidden div element:
-1
votes
1 answer

SimpleModal Error box, Overlapping Form?

http://tinyurl.com/6ekkq8y The error box keeps overlapping the form (press submit), or underlapping i should perhaps say. I've tried adding clear floats to no avail. Any ideas?
user1019002
  • 41
  • 1
  • 7
-1
votes
1 answer

React Native- Getting Error: Too many re-renders. React limits the number of renders to prevent an infinite loop while showing modal

I have a service Details page, I want to open a modal when Add to Cart Button is clicked, however I am getting too many re-renders error, I have tried alot of different things but can't seem to fix it. Please help This is the ServiceDetails…
-1
votes
1 answer

Multiple Modal Use - Bug

I have a client who wants their values image to contain a series of hot spots, so that clicking on each value opens up a video about that value. I have created the responsive hotspots, which are temporarily coloured red so you can see them, apart…
Ben Yates
  • 3
  • 2
-1
votes
3 answers

What is creating extra space at the bottom of my page?

I have space appearing below my html and body element and was wondering what caused it. This is extending my page more than it should. I have a feeling the modal window is causing it. I tried setting overflow: hidden on the body, the modal…
-1
votes
1 answer

Creating modal in bootstrap

I have a website running on Bootstrap, JQuery, HTML, CSS. I want to add a modal output on my website such that when a user clicks on a hyperlink a modal opens and prints content of a txt file. E.g. I have two text files which contains different…
Insta
  • 3
  • 5
-1
votes
4 answers

Ajax Modal fade in, close and fade out

I made a modal that loads the content from AJAX, it opens up when you click a portfolio item, so that works great :) but i can't get it to fade in, i can't get the modal to close on the cross click and i also need to to fade out. Any help would be…
-1
votes
1 answer

Close popup simple modal

I am using simple modal to create a popup , i try to add button that will close the popup but nothing happened when i click it . js library of sample model attached below is jQuery Code jQuery('a.postpopup').click(function(){ id =…
Bassem
  • 103
  • 2
  • 15
1 2 3
45
46