Deprecated: please see the current version.


SimpleModal is a lightweight jQuery plugin that provides a simple interface to create a modal dialog.

The goal of SimpleModal is to provide developers with a cross-browser overlay and container that will be populated with data provided to SimpleModal.






As a jQuery chained function, where data is a jQuery object:

$('<div>my data</div>').modal({options});

As a stand-alone jQuery function, where data is a jQuery object, a DOM element, or a plain string (which can contain HTML):

$.modal(data, [options]);
$.modal('<div>my data</div>', {options});
$.modal('my data', {options});
$.modal($('#myDiv'), {options});
$.modal(jQueryObject, {options});
$.modal(document.getElementById('myDiv'), {options});


  • New in 1.1, there are two options that enable you to pass in CSS attributes for the modal overlay and container. They are overlayCss and containerCss and take a key/value object of properties. See the jQuery CSS Docs for details.
  • In addtion to the new options, SimpleModal now handles settings some of the critical CSS properties, to prevent having to define them in external CSS files.
  • SimpleModal internally defines the following CSS classes:
    • modalOverlay: used to style the overlay div - helpful for applying common styles to different modal dialogs
    • modalContainer: used to style the container div - helpful for applying common styles to different modal dialogs
    • modalData: (Added in v1.1.1) used to style the data element - helpful for applying common styles to different modal dialogs
    • modalCloseImg: used to style the built-in close icon
Sample CSS, using default values
#modalOverlay {

#modalContainer {
  margin-left:-300px; /* half the width, to center */
  border:3px solid #ccc;

#modalContainer a.modalCloseImg {
  background:url(../img/x.png) no-repeat; 
  • For IE 6, the following will handle the PNG used for a.modalCloseImg and container positioning:
<!--[if lt IE 7]>
<style type='text/css'>
  #modalContainer a.modalCloseImg{
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(
        src='img/x.png', sizingMethod='scale'
  #modalContainer {
    top: expression((document.documentElement.scrollTop 
        || document.body.scrollTop) + Math.round(15 * 
        || document.body.clientHeight) / 100) + 'px');


Both of the SimpleModal modal() functions accept an optional options object, which can contain any/all of the following (default value):

  • overlay: (50) The opacity value, from 0 - 100. 0 = transparent 100 = opaque
  • overlayId: ('modalOverlay') The DOM element id for the overlay div
  • overlayCss: ({}) The CSS styling for the overlay div
  • containerId: ('modalContainer') The DOM element id for the container div
  • containerCss: ({}) The CSS styling for the container div
  • close: (true) Show the default window close icon? Uses CSS class modalCloseImg
  • closeTitle: ('Close') The title value of the default close link. Used if close == true
  • closeClass: ('modalClose') The CSS class used to bind to the close event
  • persist: (false) Persist the data across modal calls? Only used for existing DOM elements. If true, the data will be maintained across modal calls, if false, the data will be reverted to its original state
  • onOpen: (null) The callback function called in place of SimpleModal's open function
  • onShow: (null) The callback function called after the modal dialog has opened
  • onClose: (null) The callback function called in place of SimpleModal's close function


The callback functions are called using the JavaScript apply function. One parameter, the dialog object, is sent, which contains the overlay, container, data and iframe objects. In addition, inside the callback, this will refer to the SimpleModal object, which will allow you to access all of the available modal elements and functions.

  • onOpen: Useful for adding effects to the opening of the modal dialog elements. Your callback function will be passed an object that contains the overlay, container, data, and iframe (for IE6) elements. SimpleModal will handle "showing" the iframe, if necessary.
data.modal({onOpen: function (dialog) {
  dialog.overlay.fadeIn('slow', function () {
    dialog.container.slideDown('slow', function () {'slow'); // See Other Notes below regarding
                                     // data display property and
                                     // iframe details
  • onShow: Useful for binding events or any other actions you might want to perform after the modal dialog elements have been displayed. Your callback function will be passed an object that contains the overlay, container, data, and iframe (for IE6) elements.
  • onClose: Useful for adding effects to the closing of the modal dialog elements. Your callback function will be passed an object that contains the overlay, container, data, and iframe (for IE6) elements. After you've applied effects, etc., you'll need to call $.modal.close();.
data.modal({onClose: function (dialog) {'slow', function () {
    dialog.container.slideUp('slow', function () {
      dialog.overlay.fadeOut('slow', function () {
        $.modal.close(); // must call this to have SimpleModal
                         // re-insert the data correctly and
                         // clean up the dialog elements

Other Notes

  • For IE6, SimpleModal handles the creation and removal of an iframe, which is needed to prevent select options from bleeding through the modal dialog. If you use an onClose callback, see onClose in the Callback section above.
Data CSS Display Property
  • SimpleModal "hides" the data when it adds it to the modal dialog. If you use an onOpen callback, the display value will have been set to none and you'll need to explicitly "un-hide" the element.
Cloning and Element Removal
  • By default, SimpleModal will clone the data element that you pass in. When the dialog is closed, the cloned, unchanged, data element will be re-inserted into DOM in its original place. If persist is true, SimpleModal will "re-insert" the original element, with changes intact. If you use an onClose callback, see the onClose in the Callback section above.
  • SimpleModal always removes the overlay, container and iframe elements when closed. If you use an onClose callback, see onClose in the Callback section above.
Known Issues
  • The modal dialog will not display properly in IE7 if used in quirksmode. Fixed
Browser Compatibility

SimpleModal has been tested in the following browsers:

  • IE 6, 7
  • Firefox 2
  • Opera 9
  • Safari 3


  1. January 4, 2008 @ 11:10 am #

    Hi, I have a doubt. Could I use two callback in the same time, because it will be helpfull to me to use onOpen and onClose.

  2. January 4, 2008 @ 1:59 pm #

    @andres - Yes, you can. You can use all of the callbacks together, if you like.


        onOpen: myOpenFunction,
        onShow: myShowFunction,
        onClose: myCloseFunction
  3. January 4, 2008 @ 2:16 pm #

    Hi Eric.
    Your plugin it's excelent.
    It's possible some more demo for beginers
    Thank you
    David O.

  4. January 4, 2008 @ 2:39 pm #

    @David - Thanks! I put up a link to the test, which has some more examples. As I find time, I'll also add more to the demo page.

  5. January 5, 2008 @ 1:58 pm #

    Hi Eric.
    I have 2 question:
    1. It's possible nested modal window?
    2. how define containerCss: ({}) The CSS styling for the container div ?
    it's possible example ?
    Thank you
    David O.

  6. January 6, 2008 @ 10:22 am #

    @David -
    1) No, it is not possible to nest modal windows. If you have a compelling reason to do this, let me know and I'll consider adding that ability.

    2) There would be two reasons to use containerCss and/or overlayCss. a) you don't want to use an external stylesheet to style to modal dialog and b) you want to override values from an external stylesheet.


    	containerCss: {backgroundColor: '#ff0000', border: '6px solid #000'},
    	overlayCss: {backgroundColor: '#fff'}
  7. January 6, 2008 @ 9:57 pm #

    I am french...

    Nice nice nice, congratulation

    Thank you

  8. January 7, 2008 @ 12:54 am #

    Good work! Thanks!

    I think it more useful to change

    left:588px; in #modalContainer a.modalCloseImg



  9. January 8, 2008 @ 7:45 am #

    I found memory leak problem in IE. This problem occur practically in all simular plugins. It's no good.

  10. January 8, 2008 @ 9:08 am #

    @Roger - Glad you like it!

    @Andrey - Good suggestion. I'll update the CSS and documentation.

    @Dmitry - Care to elaborate? What is the leak, how did you identify it, etc.

  11. January 10, 2008 @ 3:34 pm #

    any static function I can call to close modal window rather than click the close link within the window

  12. January 10, 2008 @ 3:40 pm #

    @Logan - The following should work:

  13. January 10, 2008 @ 3:54 pm #

    great thanks, but it throw an error when call $.modal.close(); to close the modal window after it has been closed by clicking on the click link manually.
    I am wondering if you could add a condition within the close function to detect if the modal window still alive before any further.
    or if you could provide me a solution to check whether the modal window is alive.

  14. January 10, 2008 @ 4:12 pm #

    @Logan - good point ;) I'll need to fix that. All you need to do is add the following in the close function:

    if (! {
    	return false;

    So, you should end up with:

    close: function (external) {
    	if (! {
    		return false;
    	if ($.isFunction(this.opts.onClose) && !external) {

    UPDATE: Fixed in the 1.1.1 release

  15. January 10, 2008 @ 4:21 pm #

    cool as

  16. January 11, 2008 @ 12:59 am #

    wow, excelent...

    Your plugins is cool, but can we make the modal dialog shows centered on the page with eazy?
    (i'm sory for my bad english)


  17. January 11, 2008 @ 7:20 am #


    I used your simplemodal jquery plugin for my project. But i want to open a simplemodal when a video playing background. Can you help me about this problem?.

  18. January 11, 2008 @ 9:38 pm #

    @Hannan - Thanks! Are you asking about horizontal or vertical centering? All of the examples (tests and demos) have dialogs that are horizontally centered on the page.

    @kadir - What is the problem that you are having? Just the opacity of the "container"? If so, you could just do something like:

    	containerCss: {opacity: .4}

    Since the data is inside the container, it will inherit the opacity value as well. This requires v1.1.

  19. January 13, 2008 @ 5:01 am #

    Hi Eric,
    Excellent jQuery addition, thank you very much!

  20. January 14, 2008 @ 5:05 am #

    hi again,

    the problem is that the embedded video playing at the background disappears when the modal window appears.
    my screenshot contains the scene I'd like to achieve.
    do you know any workaround to bypass this problem?
    thanks in advance.

  21. January 14, 2008 @ 8:37 pm #

    I'd like embed your script into Drupal but unfortunately, your script not runs with jQuery old version 1.1.2. Can you show me how your script run with jQuery 1.1.2?

    Thanks a lot.


  22. January 14, 2008 @ 11:30 pm #

    @kadir - what browser are you using? The sample I showed should work unless the video itself is doing something funny.

    @dong - SimpleModal is compatible with jQuery 1.1.2. If you are trying to use the contact form, the animations require jQuery 1.2+. Let me know...

  23. January 15, 2008 @ 7:01 am #

    i'm using firefox i tested for youtube video player (simplemodal on a embeded SWF) and it worked. But neither VLC nor Media Player not worked. in our application, we are supposed to use vlc plugin on firefox for playing media.

  24. January 15, 2008 @ 9:47 am #

    @kadir - I was testing with a YouTube video. I'll try the other ones and get back to you.

  25. January 16, 2008 @ 3:06 am #

    Hello ! Nice plugin you have here ! :)

    Maybe it's really obvious but I was wondering how I could pass a variable to $.get("./simplemodal/data/myform.php", function(data) {}
    so that it calls myform.php?var=xx where the xx is something I have in the URL of the main page (eg $_REQUEST['var'] in php). I hope I'm clear :)


  26. January 16, 2008 @ 3:41 am #

    ok I think I've found a solution using a hidden input field and accessing it thanks to its id within the get call :)

    $.get('./simplemodal/data/myform.php?itw='+$('#numint').val(), function(data){...}

  27. January 16, 2008 @ 10:09 am #

    I just admire people who can make this kind of js. Just I can't close my jaws and saying wow.
    I am a beginner and please excuse my elementary question. I installed the contact form in my testing website, and looks great, but it doesn't send email. How can I make it to send email? Do I need to put any code or modify any php? If I will be grateful if someone can help a newbie.

  28. January 16, 2008 @ 10:25 pm #

    Hi Eric, this is an excellent light weight plug-in. Is it possible to have the popup vertically centered? I noticed the window is controlled by the top and left values in CSS, but it would be good if it would stay in the centre of the browser (to maximise real estate and have no gaps at the top or left on small screen resolutions). Thanks for your help.

  29. January 16, 2008 @ 11:05 pm #

    @Guillaume - glad you got it worked out ;)

    @elvis - when you say it doesn't send email, what exactly is happening. Does it say it it was sent or that there was a problem? Double check the "To:" email address. Contact me directly to troubleshoot.

    @Jatin - Currently it is set to be 15% from the top, but you can simply change the CSS, according to your needs:

    #modalContainer {
      margin-left:-300px; /*half the width, to center */
      margin-top:-200px; /* half the height, to center */
      border:3px solid #ccc;

    You'll need to update the IE CSS as well...

  30. January 17, 2008 @ 1:46 am #

    Just wanted to say well done and congratulations on creating this simple to use modal plugin for the jQuery library.

    Keep up the great work!

  31. January 18, 2008 @ 3:47 am #

    Is it possible to load a pdf file or a web page held at another website into a modal dialog? If so, any chance of example code?


  32. January 18, 2008 @ 5:58 pm #

    i have integreated your contact but cannot seem to get the dialog to load when i click the button. I have scanned over code and included all files needed for inclusion but still i cannot get the dialog to pop up. Is there anything further needed for the dialog to pop up?

  33. January 18, 2008 @ 10:08 pm #

    @Neil - thanks, I appreciate the kind words!

    @Bruce - it is possible, by embed it into an object/embed tag. I used a file from and was able to get it to display.

    @matt - are you using the code from the demo? Do you have a link that I can see? You can contact me privately, if you like.

  34. January 20, 2008 @ 4:06 pm #

    I seem unable to be able to call the script on unload of a window? I imagine this is my fault either doing it wrong or not understanding the limitations of the language/script, but I would very much appreciate any direction you can offer. I love the functionality, and its exactly what I have quite a few clients asking for. I imagine it would look something like this

    $(window).unload( function () {

    Thanks much.

  35. January 22, 2008 @ 12:13 am #

    I was testing with a YouTube video. I’ll try the other ones and get back to you.

    Hi Eric,

    Could you test it?

  36. January 22, 2008 @ 9:45 pm #

    Hello, thank you for putting this together. I have been looking hi and low for just this thing. Perfect. We all owe you one man.

    Anyway, my question is can you have two or more simple windows going at the same time, one would be lets say 300px by 400 and another sized diffrents for a diffrent purpose.

    Also is it possible to change the class name #modalContainer to something that is more unique? One app I am working on will be a widget that will be placed on many other website that are out of my control. Chances somebody else having a modalContainer class name could exist. Thank you again.

  37. January 23, 2008 @ 9:49 am #

    @chris - if you are trying to catch when a user leaves a page or closes the window, you need to use the onbeforeunload event. It has it's own built-in dialog, so as far as I know, it would be difficult (if not impossible) to display a modal dialog in place of the built-in confirmation. I spent some time trying something similar in an app, and ended up just using the built-in dialog.

    @kadir - sorry for the delay. I tried out a few tests last night and I couldn't get a transparent div to show the video (vlc or mov) behind it. It must be a limitation of the embedded video player itself.

    @john - i've had a few request for this recently. It would take some re-design of SimpleModal and I'd still need to understand the exact requirements. For example:

    - the first instance creates the overlay, container and data div
    - the second instance creates an additional container and data div, with a different z-index, but does not create an additional overlay.

    Does that sound right? I'd guess that would require the ability to "move" the containers as well? Or would it just be up to the CSS positioning?

    Contact me with ideas/input and I'll see if I can put something together...

    As for your last question...the class name is hard coded, but you can change the ID of the element when you create it $.modal(elem, {containerId:'myUniqueId'})

  38. January 26, 2008 @ 11:40 pm #

    About nested (or multiple) modal windows request...
    It will be quit useful (actually I am looking for this feature as well). Example from the real life... I use your modal window to display the list fo private messages for a user and I would like provide ability to respond without exiting the list of messages.

  39. January 29, 2008 @ 12:22 pm #

    Hi Eric, great plugin you got there!!

    I just have a question, im using your plugin to put a modal alert on my site, i based on the confirm demo, so its a copy/paste and just some edition on it... now the issue that i have is that on IE7 i cannot get the overlay to cover the full area of the site, it just covers the first visible area of the page, what could be doing that?

    I mean i got the confirm.css and confirm_ie.css files just edited a bit of the colors and thats it, but i cannot get the same overlay coverage on my site than in your example... any suggestions?

    This just happens with IE7, FF is working great.



  40. January 29, 2008 @ 12:45 pm #

    @Adrian - I just double checked the demo and it works correctly, so it must be something in your page. What DOCTYPE are you using? Do you have any CSS applied to body or html?

  41. January 29, 2008 @ 2:53 pm #

    There isnt any css applied neither to body nor html, and there aren't any DOCTYPE declared, do i have to have one to make it work correctly?

    Thanks Eric!

  42. January 29, 2008 @ 3:20 pm #

    BTW, the page is a JSP, sorry :P

  43. January 29, 2008 @ 3:28 pm #

    Ok i did put a DOCTYPE for it, the line i added at the beginning of the jsp is:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    But im having the same issue, the overlay div is only at the size of what i can see, but if i move the scroll down or right i see the elements below not covered by the div and i can click on them... do you have a suggestion to apply some sort of style to the created overlay div to fix this?


  44. January 29, 2008 @ 4:24 pm #

    @Adrian - can you email me some sample code or send a link? It's hard to troubleshoot without seeing something ;)

  45. January 30, 2008 @ 9:45 am #

    Hi Eric,
    I also need 'nested modals' feature. I need it to update an entry form modal 'records list'.


  46. January 30, 2008 @ 9:47 am #

    Eric, i made it! It worked ok using the methods Screen.getDocumentHeight, and Screen.getDocumentWidth from just integrated those methods and modified the jquery.simplemodal.js in the function fixIE section to make it to work, just changed the vars:

    fixIE:function(){var wHeight=Screen.getDocumentHeight()+'px';var wWidth=Screen.getDocumentWidth()+'px';

    it works great!!

  47. January 30, 2008 @ 11:51 am #

    I use your modal window for displaying alert and confirm message.. Its really working great.. thanks a lot for your work..

    i have a small issue.. in small screens, the ok button goes below the screen visible area, and scolling doesnt help, as the modal window also gets adjusted accordingly and still ok button is not displayed..

    Is there any way to prevent adjustment of modal window?

  48. January 31, 2008 @ 3:13 pm #

    Eric, Adrian here again, i have another question for you...

    Nowadays with the actual overlay of your simplemodal tool, you can select the elements below it using the tab button and execute its functions, is there a way to avoid it without blocking the tab key with JS?


  49. February 1, 2008 @ 4:32 pm #

    Hi Eric... Is there a way to make a simplemodal window draggable??


  50. February 2, 2008 @ 9:14 pm #

    this is a trivial issue, but I've tweaked the css and js and can't seem to find the cause:

    i borrowed the x.png image from 'basic' example and used in it 'contact form' example. Everything works as expected when I click x.png image except the x.png image fades out about .5 second after the form - the delay is noticeable. Obviously I'd like them both to fade out simultaneously.

    Can you point me in a direction to find the cause. Thanks, great plugin.

  51. February 4, 2008 @ 10:01 am #

    @senthil - I believe that you are referring to the fact that the dialog is fixed. If you want it to scroll out of sight, you'll have to change the CSS position to absolute.

    @Adrian - 1) the modal dialog is just another element on the screen, so tabbing to a different element is still valid. Like you mentioned, you'd have to specifically block tabs or whatever your need may be.
    2) If you want the dialog to be draggable, I suppose you could check out the jQuery UI Draggables...although I have not tested its compatibility with SimpleModal.

    @Lee - I suppose you could change the close function to look something like:

    close: function (dialog) {'.modalCloseX').fadeOut(200, function () {, function () {
    			dialog.container.fadeOut(200, function () {
    				dialog.overlay.fadeOut(200, function () {
  52. February 6, 2008 @ 10:32 am #

    I've got this working wonderfully now, but as Adrian said - the user can still tab to other elements, stopping this from being an actual "modal" dialogue box. If I block the tab key entirely, it stops the user from using the fields in the dialogue box itself. In a perfect world, I could pass a parameter to make all elements outside of the modal dialogue box untabbable. Any ideas?

  53. February 7, 2008 @ 8:58 am #

    @Antony - I found some ideas regarding this concept...basically, the suggestion was to watch for focus on a body element and 're-direct' the focus back to the modal dialog. It's something that I'll put on the to-do list.

  54. February 7, 2008 @ 9:59 am #

    Hey eric, its me again. You helped me in the past make links clicable for the contactor. now i seem to have a problem. it use to work great, but the version i had for some reason caused problems in IE 6. like when the contactor would load, it would appear at the bottom left and be barely visible and the overlay wouldnt cover the page.
    i just downloaded your newest version. but when i changed the code in the js file to make a link with class smcontact load the contactor, it dosnt load it any more. i was wondering if theres more to it now thats its a newer version.

  55. February 12, 2008 @ 6:06 am #

    nice prototype i like it. its good

  56. February 12, 2008 @ 6:06 am #

    good work

  57. February 12, 2008 @ 7:28 pm #


    Great plug-in! Well thought out, easily integrated, and no showstopper bugs.

    Having trouble viewing a SWF video in simpleModal in Firefox. Amazingly, IE6 works fine. I noticed above that you had a demo working. Can you post that code or have any ideas what I may be doing wrong?

  58. February 13, 2008 @ 6:42 am #

    Hi Eric.

    Perhaps I'm missing something obvious.. what I want to do is to make the modal dialog go away just by clicking anywhere else outside the dialog. Is there some way to modify SimpleModal to get that functionality?


  59. February 13, 2008 @ 1:11 pm #

    @Susie - I can't find the code anymore, but basically, I just took one of the YouTube object/embed statements, and put it in a div that was hidden. Then I used that div when I called the modal dialog.

    What is the problem you are having?

    @deepak - You could modify the script, or you could just add it to an onShow callback:

    $.modal(data, {onShow: function (dialog) {
'click', function () {
  60. February 13, 2008 @ 2:09 pm #

    well if you need to see whats happening, you have to have IE 6. but on my main page i have alot of tables, and your modal loads under the tables (bottom of page) in IE 6.
    is there a way to fix that?

  61. February 13, 2008 @ 9:23 pm #

    GREAT Code ! GREAT Code !

    on the demo you are usinf a buttom , how can I just make it a link ? ( i'm new to this )


  62. February 14, 2008 @ 8:27 am #

    @Eric: That worked! Thanks!

    @jeff: Something like this should work..
    <a href="#" onClick="javascript:$('#modaldiv').modal()">Open</a>

  63. February 14, 2008 @ 10:30 am #

    @jeff - Something like:

    <a href="#" id="testLink">Test</a>


    $('#testLink').click(function (e) {
  64. February 14, 2008 @ 11:21 am #

    Awesome plugin, Eric! I have some suggestions that may help you improve it:

    - Add support for ESC key to close the dialog
    - Make the dialog box "auto-center" instead of doing it via CSS... Dimensions plugin is very good at helping with that.
    - Add support for "width" and "height" as optional attributes instead of doing it via CSS
    - Right now the content of the dialog box can't be too big because it won't fit the dialog. My suggestion would be to make it overflow inside the dialog box. Doing it through CSS messes the Close Button because it is inside the dialog content.

    Thanks for sharing and keep up the good work.

  65. February 14, 2008 @ 11:48 am #

    Oh, yeah... one more suggestion:

    Right now when using a jQuery DOM attached element ($.modal($('#modalContentTest'));) the element is actually removed from the DOM and pasted into the dialog.

    What I suggest is that you add an optional parameter called "keepSource:boolean" or something similar that keeps the original DOM element in its original place.

    Also, when the user closed the dialog the DOM element is pasted back into the HTML, but not in the same place it was before, making it unusable in most real world cases.

  66. February 14, 2008 @ 3:16 pm #

    Eric, Great plugin! Of course I'm having the same problems with IE that I always have. IE never seems to play along. I'm trying to use a simple modal like so:

    $("#form").submit(function() {
    $('Processing....Please Wait.').modal();
    return true;

    Works great in FF but IE6 gets the overlay size wrong. The overlay doesn't fill the screen. There's a little strip on the right and any screen real estate below the last html element is not overlaid. I'm using HTML 4.01 transitional doctype and I don't have any css directly attributed to the html or body elements. I don't want to have to resort to Adrian's solution because it shouldn't be necessary. Your tests and demos work correctly for me in the same IE6 browser that I'm currently cussing.

    Can you point me to some possible causes? I've looked at the IEfix function and it uses height and width of the document body and not the viewport so is this the expected behavior for a document that is shorter than the viewport's height?


  67. February 14, 2008 @ 4:05 pm #

    Hi eric

    i have tried :

    $('#testLink').click(function (e) {
    <a href="#" rel="nofollow">Test</a>

    but when i click on it nothing happpens.

  68. February 15, 2008 @ 6:19 am #

    Oh, about my second comment from yesterday, my bad... just use the clone() function and the jQuery DOM element, well, is cloned... lol


  69. February 15, 2008 @ 7:07 am #

    @Stuart - try adding the following CSS:

    body {
       margin: 0;
       padding: 0;
       width: 100%;
       height: 100%;

    @jeff - you need to add the id attribute to the link:

    <a href="#" id="testLink">Test</a>
  70. February 15, 2008 @ 11:31 am #

    Hi Eric;

    here is what i have for the link , but when you click on in , nothing happens:

    <script type='text/javascript'>
    $('#testLink').click(function (e) {
    <a href="#" id="testLink">Test</a>

  71. February 16, 2008 @ 8:37 am #

    @jeff - do you have something in your page with an id of basicModalContent?

    @Feed - Thanks for the comments and suggestions. I'm working on a new version and plan to add the ESC to close feature and am also making it so you can pass all the styling options through JavaScript, eliminating the need for external style sheets (if desired).

    I'm hesitant to add auto-centering because I've tried to avoid taking control away from the end-user. I could make it an option.

    I'm working on the overflow fix...I agree that it should be there.

    I'm a little confused about your second post regarding the DOM elements. Currently, if the data object came from the DOM, SimpleModal will keep track of its parent and when the dialog closes, it will append the element back to its parent.

    As far as it going back in the exact same place, I'm not sure why it would matter. Unless you have a different requirement, most of the data used in a modal dialog (that comes from the DOM) will be hidden until it is used by SimpleModal.

    Lastly, there is the persist option, which if true, will not clone the data. That means that you can modify the element and SimpleModal will put it back in the DOM with the changes intact.

  72. February 16, 2008 @ 8:33 pm #

    I took your suggestion in the jQuery Google Groups and I've been testing your plugin for the past couple of hours but I'm having a few difficulties accomplishing some stuff...

    1) Through out my code I call $('#EXAMPLE-ID').modal({options}) numerous times and I have a bunch of options repeating through every call. This kinda sucks... Is there a way I could configure the default options values and then simply call $('#EXAMPLE-ID).modal() and it will simply show the modal dialog with the options configured before? Also, in a way that if I want to override some of those default option values I've set, it would be nice...

    2) I don't use a close 'X' button on my modal dialogs, I prefer to close the dialog manually in a different way-- by clicking anywhere inside the modal dialog and for that, I bind the click() event to the respective ID. But for this to work, I need to close the modal dialog manually. I used to do the following using jqModal:
    $('div#popup-content').click(function() {

    How can I accomplish the same thing using your plugin?

    3) Last but not least... I've read the documentation here on this page about the onOpen and onClose callbacks but I'm not able to do want I want. Basically I want the whole modal dialog (overlay and container) to fade in (onOpen) and fade out (onClose) at the same time, like they were just one element with, for instance, 1000ms for both animations. How can I do that?

  73. February 16, 2008 @ 11:09 pm #

    Hi Eric;

    the only place i have basicModalContent in the below :

    <script type='text/javascript'>
    $('#testLink').click(function (e) {
    <a href="#" id="testLink">Test</a>


  74. February 17, 2008 @ 8:56 am #

    @Nazgulled - I'm glad you gave SimpleModal a look...I know there are a lot of other options out there!

    1) If you want to globally change the defaults, you can do so with something like:

    $.modal.defaults.close = false;

    You can do that for each property that you want to change. Then if you want to override one of those new values for a specific instance, just pass it in the options in the modal call.

    2) For SimpleModal, you can do:

    $('div#popup-content').click(function() {

    3) Try something like the following:

    	onOpen: function (dialog) {
    	onClose: function (dialog) {;
  75. February 17, 2008 @ 10:41 am #

    Thank you Eric... When I posted that it was 4AM here and I was very sleepy, I managed to most of the things you just replied before seeing your answer. It took a while but I did it...

    Few things though:
    1) I did something more like this:
    $.modal.defaults = $.extend({}, $.modal.defaults, {
    overlay: 60,
    overlayId: 'popup-overlay',
    containerId: 'popup-wrapper',
    close: false,

    Which, I think, looks better, but it's a matter of taste.

    2) I don't if it's just me or what but I don't think it's very consistent this way... Perhaps you could implement the show and close methods like in jqModal? I'm saying this because I think it makes more sense to do $('ID').modal(options).show() vs $('ID').modal(options) and $('ID').modal().close() vs $.modal.close(). Just a suggestion... I think it's better and more consistent.

    And this way, we could easily have more than 2 "modal" dialogs at a time. But that's up to you...

    Thanks for the great plugin!

  76. February 17, 2008 @ 1:04 pm #

    @Nazgulled -

    1) That works too... TIMTOWTDI ;)

    2) In the new version I'm working on, you'll be able to call close on the object directly. I don't know that I want to add a show() was something that I didn't like that about jqModal. I guess it's a matter of preference, but I'll consider your input as I re-write the code.

    Also, the new version will support multiple modal dialogs.

  77. February 17, 2008 @ 3:24 pm #

    Thanks for all your effort. I've just subscribed to your feed to keep me update ;)

  78. February 18, 2008 @ 11:35 am #

    Hey Eric,
    First of all - a terrific piece of art your got there :D I say "art", coz I firmly believe in what the folks @ WordPress say i.e. "Code is Poetry".

    Anyway, coming back to the real topic, I was trying the fade-in/out effect of SimpleModal and tried to follow the code you've outlined in the reply to Nazgulled -

    onOpen: function (dialog) {
    onClose: function (dialog) {;

    What happens in my case is that the very first time I click on the popup link, the modal dialog fades in.. upon closing it, it fades out just fine too. But then on, it simply refuses to show anymore. Not just that, any other modal dialogs (I got 3 different ones on a page) don't respond to clicks either.

    If I take away the codeblock shown above, the dialogs appear/close at will without any hiccups.

    This occurs both in IE and Firefox. Has anyone come across this problem earlier? If someone has face + solved this problem, kindly point me to the right direction...

    m^e :)

  79. February 18, 2008 @ 1:05 pm #

    @miCRoSCoPiC^eaRthLinG - ahh yes...there is a problem with the onClose callback. It should be:

    onClose: function (dialog) {;
        dialog.overlay.fadeOut(1000, function () {
            $.modal.close(); // closes the dialog after all events
  80. February 18, 2008 @ 4:21 pm #

    Me again, I'm having 2 little issues that are getting on my nerves :S

    1) I am not being able to manually close the dialog with a fade effect. I mean, I'm binding the click event of dialog itself to close it with $.modal.close() and I have this code:

    $.modal.defaults = $.extend({}, $.modal.defaults, {
    overlay: 60,
    overlayId: 'popup-overlay',
    containerId: 'popup-wrapper',
    close: false,
    onOpen: function(popup) {
    popup.container.fadeIn(250, function() {
    if ($.browser.msie)'filter'); // Fixes IE7 ClearType bug
    });, function() {
    if ($.browser.msie)'filter'); // Fixes IE7 ClearType bug
    onClose: function(popup) {;
    popup.container.fadeOut(250, function() {

    The onClose code is commented because it's not working. If I uncomment the code and click on the dialog to close it, it closes fine but does not fade out. What's wrong?

    2) I don't know why, but I have some stupid bug on IE7 display the popup, it works fine on FireFox. Here's my code:


    div#popup-wrapper {
    width: 360px;
    left: 50%;
    top: 80px;
    margin-left: -180px;

    div#popup-block {
    display: none;
    background-color: #ffffff;
    border: 2px solid #103b74;
    cursor: pointer;

    div#popup-overlay {
    background-color: #000000;
    cursor: wait;

    img#popup-icon {
    margin: 5px 0 0 5px;

    div#popup-title {
    font-weight: bold;
    font-size: 14px;
    margin: 12px 10px 0 0;
    color: #5c5c5c;
    float: right;

    div#popup-notice {
    background-color: #e4f0ff;
    margin: 5px 5px 5px 5px;
    padding: 5px;
    color: #103b74;

    And what's happening on IE7:
    (in case one link fails, the other should work)

    Hope these 2 problems are easily fixable...

  81. February 18, 2008 @ 9:07 pm #

    Dammit, the HTML code wasn't posted correctly. How can I post code like you Eric?

  82. February 18, 2008 @ 11:37 pm #

    Thanks Eric - that $.modal.close() did the trick. However, the dialog refuses to fade out.. instead it just goes off as it would normally. Only the fade-in part is working.

    A small question for Nazgulled: What exactly does this code do -->

    if ($.browser.msie)'filter'); // Fixes IE7 ClearType bug

    I understand it fixes some cleartype bug.. but what exactly is this cleartype bug and how is it fixing it...


  83. February 18, 2008 @ 11:56 pm #

    One more question for you guys.. Any fade in/out effect using jQuery looks pretty horrible in Internet Explorer, horrible as in, while the fading action is taking place all the text and PNG (transparent) graphics become grainy and kind of smudged. They get back to their original state once the effect is over. This isn't a problem in Firefox or Opera whatsoever..

    Does this have to do anything with the cleartype bug you were talking about? If so, I'm afraid those two lines of code didn't help much. Any ideas why?


  84. February 19, 2008 @ 5:53 am #

    Yes, the fuzzy text is the "bug fix" on my code. When using opacity for elements that have text in IE6/IE7, this problems occurs.

    IE6) To fix the bug on this browser, you need o add a background-color to the text element that gets fuzzy and it won't happen anymore.

    IE7) There is no way to fix the fuzziness during the animation, the text will always look rough. You can, however, when the animation ends, put the smooth text back and for that, you use the code that I posted above.

    You can do a simply workaround to this problem (for both browsers) if the background where the dialog appears is a fixed color or a fixed image that won't change. I mean, instead of fadding in the element (for instance), you had another element on top of that with the color of the background and fade out that element instead. See what I mean?

  85. February 19, 2008 @ 12:46 pm #

    Thanks Eric. That css code works a treat.

  86. February 19, 2008 @ 2:35 pm #

    Very good job, i just have a problem on ie 7, the modal box is hiding by a swf banner.
    Thank you for this great work

  87. February 19, 2008 @ 7:20 pm #

    @future maman: Try adding a wmode="transparent" parameter to your swf banner. I've faced a similar problem while using another modal dialog (ModalBox - based on Prototype + Scriptaculous). The banners on the page below would sort of "burn" through the dialog box and show-up inside it along with the content. The wmode parameter took care of it.

    @Nazgulled: Thanks a lot for that nice explanation :) Will give your recommendations a shot and report back..


  88. February 20, 2008 @ 11:25 am #

    I found a "fix" for IE7 in quirksmode. In jquery.simplemodal.js, just under create: function () {, add the following:
    var pos = ($.browser.msie && /^7.*/.test($.browser.version) && !$.boxModel) ? 'absolute' : 'fixed';

    Then in the create function, replace the two instances of 'fixed' with pos.

    So, the entire create function should look like:

    create: function () {
       var pos = ($.browser.msie && /^7.*/.test($.browser.version) && !$.boxModel) ? 'absolute' : 'fixed';
       // create the overlay
       this.dialog.overlay = $('<div>')
          .attr('id', this.opts.overlayId)
          .css($.extend(this.opts.overlayCss, {
             opacity: this.opts.overlay / 100,
             height: '100%',
             width: '100%',
             position: pos,
             left: 0,
             top: 0,
             zIndex: 3000
       // create the container
       this.dialog.container = $('<div>')
          .attr('id', this.opts.containerId)
          .css($.extend(this.opts.containerCss, {
             position: pos, 
             zIndex: 3100
             ? '<a class="modalCloseImg ' 
                  + this.opts.closeClass 
                  + '" title="' 
                  + this.opts.closeTitle + '"></a>'
             : '')
       // fix issues with IE and create an iframe
       if ($.browser.msie && ($.browser.version < 7)) {
       // hide the data and add it to the container
  89. February 20, 2008 @ 11:41 am #

    @Nazgulled - right above the reply textarea is the info on how to post code.

    As for your onClose function, you have to nest the fadeOut calls and the close...try:

    onClose: function(popup) {, function () {
          popup.container.fadeOut(250, function() {
             popup.overlay.fadeOut(100, function () {
  90. February 20, 2008 @ 4:17 pm #

    I have applied the fix for IE7 quirksmode and observed that the overlay is properly positioned, but the container remains at the end of the page (or wherever you defined it). The fix sets the position css to absolute, but it doesn't see any coordinates so I am wondering how it is supposed to get centered.


  91. February 20, 2008 @ 6:38 pm #

    Eric, about the code posting, yes, I see the info how to post code and that's what I do, but it looks different from yours. Yours have a border and the background color is darker, the way I do it (with the (pre)(code)CODE(/code)(/pre) but with ) only uses a different font for the code.

    Anyway, to my problems, I got confused...

    1) I used the code you post to have the popup fade out when closing but it isn't working. The popup just closes, it doesn't fade.

    2) About the overlay problem... I don't if that create function replacement was for me or not, but I tried it and it didn't work.

    But just so I don't get more confused, continue the overlay issue on the jQuery groups which you have already replied and I'm going to reply to you there in just a moment. And please help me with the close fadeout here.

  92. February 20, 2008 @ 7:28 pm #

    I found out the problem about my fadeOut using $.modal.close(); but I don't know how to fix it...

    You see, I'm using this:

    // Allows the popup notification to be hidden when clicked
    $('div#popup-block').click(function() {

    As I've told you before, so that the popup is closed by clicking on it self.

    Looking through the code of simplemodal I realized that when I call $.modal.close() the $.modal.impl.close(true); has the external parameter set to true and that will ignore the onClose callback which means the fadeOut effect will be ignore.

  93. February 20, 2008 @ 7:52 pm #

    Sorry about all this posts...

    I just found a way to fix it which I think it's not a fix, but the correct way to do it. First, my onClose callback was ok, I mean, the following works:

    onClose: function(popup) {;
    popup.container.fadeOut(250, function() {

    However, I cannot manually bind the $.modal.close() to the click event of some HTML element. Instead, I just set the class of the element (in my case, the popup-block) to "modalClose". Actually, I did this $.modal.defaults.closeClass = 'popup-close';, and set the class of the element accordingly. But either way, it works, because this way, the onClose callback will be executed cause this is an internal call to the modal.close.


    One thing about something I noticed... First, are you going to release a new version soon or you are not thinking about it for now? I have a suggestion, cause, I've commented a few lines on the source code that I think are not doing anything there, they are:

    Line 181: = data;//.addClass('modalData');
    Line 205: //.addClass('modalOverlay')
    Line 221: //.addClass('modalContainer')

    I mean, we already have IDs set to the modal elements, why do we need this classes? They are not being used at all and I don't like to have code on my applications that I don't use. My suggestion is to get rid of this, but I believe you have some use for them so here's a more detailed suggestion:

    Allow us to configure which IDs/classes do we want to use in your modal dialog HTML elements (overlay, container and data) and their names. First, you only allow to change the name of the IDs and not the classes, you should allow them both to be configured. Second, you should also allow to use the ID/class or not for that specific element.

    Just a suggestion, I don't know what your up to for the next version.

    Anyway, do you think my solution for the onClose thing is good?
    Now I'm just left with the problem of the overlay in IE6/7...

  94. February 20, 2008 @ 7:57 pm #

    Hi Eric...
    I'm a beginner in PHP and javascript but I wan to create my admin site with Your wonderful JS. So can you please teach me step by step how to implement this wonderful JS, suppose that. I have a View.php which look like this :

    | ACTION | ID1 | NAME|
    |edit | delete | 1 | ME |
    |edit | delete | 2 | YOU |
    |edit | delete | 3 | US |

    and the process should be like:
    when I click edit link it will show a simple modal form with data in it.
    after that when I click save button in the form it will save my data in that form and close that form so it shall return to my view list.

    forgive my english also :) and Thanks Before yak..
    salam, setiawanthea

  95. February 20, 2008 @ 10:53 pm #

    @Craig - there was an error in the code I posted, can you try again? The positioning comes from the CSS.

    @Nazgulled - yes, I'm working on a new version, but no it will probably not be ready "soon". I had something close, but I'm re-thinking some aspects of it.

    As for the addClass comment...classes and ID's serve different purposes. I add the class to allow common styling across multiple dialogs (if desired). If you don't need/want to use that "feature", that's fine...but it doesn't mean that the code not doing anything or not needed. ;) I could make the class an option, but I don't know that it is really necessary.

    Your onClose "solution" is what I do in my projects. And I don't know what to tell you about the IE issue. The CSS I provided should fix it in IE6 and I don't see the issue in IE7 (you say you do an have found a everything should be good now, right?)

    @setiawanthea - that's a pretty loaded question ;) Basically, you'd display the dialog and use the onShow callback to bind the save button to perhaps an Ajax call. If that is successful, close the dialog (and perhaps update the original page) or if there is an error, display the message.

  96. February 21, 2008 @ 3:51 am #

    1) About the classes thing, I do believe it's necessary to make it an option because I think it's pointless to have code you don't use. I'm saying that it won't ever be used by me or someone, but by default, it's being created but not used. It should be made an option and people who wants it, use it, and the others don't...
    What if for some reason I have different code that uses the class names that are hard coded in your plugin? That will create strange behavior... I think that making an option to allow us to give names to the IDs/Classes and to select if we want to use those or not is the best thing. I mean, SimpleModal will still work just as good and you provide choice to the users to configure it the way they want.

    2) About the close solution, I'm still left with a little issue that I just noticed. I mean, I want the popup to be closed when clicked, done that with the popup-close class. However, there's ONE situation where I still need to manually call $.modal.close(). You see, I use a modal dialog in every page, while the page is loading, I show the modal dialog in the $(document).ready() and I close it in $(window).load() which will be called when the page finishes loading.

    Basically I have this:

    $(document).ready(function() {

    $(window).load(function() {

    And like I said before, calling $.modal.close() like this, ignores the onClose callback and there's not fadeOut effect. Any ideas on how to work around the issue?

    3) As for the IE problem. Yes, it's fixed in IE7. Like I said on google groups, the problem is on the browser detection of jQuery that detects IE7 on Vista as IE6 and that will make SimpleModal call the fixIE() method, which will break the overlay on IE on Vista. But the problem persists on IE6... Maybe I'm missing something. Could you provide the most simple example-- and by simple I mean, with the less lines of code possible, only with what's needed-- to show the modal dialog in a way that is working on IE6? Maybe I'm missing something that we are both failing to see on my example...

  97. February 21, 2008 @ 1:22 pm #

    @Nazgulled -
    2) I guess if you wanted to, you could change it so $.modal.close() accepted a parameter (true|false) and that way you could have it call the callback if you wanted it to. Or you could create a new function that did the same thing.

    3) The tests and demos all work in IE6, so I'd look there. What version of IE7/Vista are you running that is reporting IE7 as IE6?

  98. February 21, 2008 @ 2:11 pm #

    2) I remember having tried to do something like that but for some reason, the close behavior was weird... I might try it again. But, why is there such an option? I mean, the "external" thing in that method, what it's purpose?

    3) I've already fixed the problem on IE6. You were right about the body styles you told me in the google groups. The first time I tried them, I must have done something wrong.

    But now I'm having a problem with Opera, regarding the same thing, the overlay. If I open the demo page on your site and test it with Opera, it works well, but if I download the basic sample and test it on Opera, it doesn't quite work.

    The problem is, when you click to show the modal dialog, it shows
    fine. But after closing it, you will see something odd... Look at the
    screenshot, it shows what's happening after closing the dialog:

  99. February 21, 2008 @ 5:22 pm #

    Hi Eric~
    Are you familiar with asp? If yes ,is that possible to configure configure.js
    to respond such value as below?

    <a href="memberstatus.asp?memberstatus.asp?course=">

    Because previously my memberstatus.asp is someting like yes/no page; If user choose yes it will redirect to member register page if not a member it will redirect to member register page(but without member id/expired date field) Are you able to help?
    If can i can email you the coding o gimme some hint over here.

    Thanks in advance.

  100. February 22, 2008 @ 3:56 am #

    Nice plug in Eric.
    It seems i have problem in IE 6,when page is scrolled down using the scroll bar the dialog box(modal) also scrolls with it.It doesn't happen in firefox.I also looked at your Demo modals, it too have same problem with IE 6.

    Thanks in advance

  101. February 22, 2008 @ 6:07 am #


    I'm new in jquery and I'm wondering how can i use your plugin to open a modal window but, instead of showing html code from a div inside the page, doing it from a external html file.

    I've tried:

    but nothing happens. any suggestion?

  102. February 23, 2008 @ 5:11 pm #

    I think I managed to close the modal dialog like you said to do it Eric. So, about #2, is the following what you meant?

    $('div#popup-wrapper').fadeOut(250, function() {
    $('div#popup-overlay').fadeOut(100, function() {

    If it's not, nevermind, cause it's working... :)

    I'm just left with problem #3, the overlay on opera that doesn't quite work fine... Please read my description above and/or see the post at jQuery google group. Fixing that, and all my problems with SimpleModal are gone for the time being... :)

  103. February 24, 2008 @ 8:44 am #

    @eugene - I'm not exactly sure what you are trying to do. You can email me with more details, if you like.

    @Benkibirugaali - I'll take a look, thanks.

    @oscarml - afaik, the load function doesn't work that way. You could try something like:

    var data = $.get('test_data.html');

    @Nazgulled - I don't have Opera on this pc, so I can't test. However, if it is working in the demo's but not your site, it sounds like an issue with your code.

  104. February 24, 2008 @ 9:05 am #

    But my code is copied from your site demos...

    And like I said before:

    If I open the demo page on your site and test it with Opera, it works well, but if I download the basic sample and test it on Opera, it doesn’t quite work.

  105. February 24, 2008 @ 11:31 am #

    In case anyone wants to know I think I found out the problem:

    The thing is, in Opera, the whole page(100%) has to be filled with something. I mean, if your page is long enough (you have a vertical scrollbar), you won't have this problem. But lets say your page only fills like 70% of the screen, the other 30% doesn't have anything, no elements get there, the is at the 70% mark, if you understand what I'm saying. To fix the problem, you need to make sure your page is filled at 100% on the screen. A simple fix would be the following code on CSS:

    html { height: 100%; }
    body { height: min-height: 100%; }

    This seems to fix it on my testing, however, you may end up with some strange results if your design is complex and uses lots of CSS styling. Basically, you just have to play around with the CSS code and make sure the whole page is filled with something, otherwise, opera will you only re render the page where it has elements.

    Although this code didn't fix my real live example-- for some strange reason, it was working without changing anything, maybe some other changes I did fixed it somehow-- but it fixed with all the tests I did.

  106. February 25, 2008 @ 1:39 am #

    This is not working:

    var data = $.get('test_data.html');

    it fills the data var, but doesnt open any modal.

    any idea?

  107. February 25, 2008 @ 1:41 am #

    Sorry, I said it doesnt open the modal. Actually, the var data is filled, and the modal windows is openned, but nothing inside.

    any ideA?

  108. February 25, 2008 @ 4:31 am #

    Hi Eric,

    I was wondering if it would be possible to pass a variable to the contact.php file in your simplemodal contact script, and if so how? I love the script but as always there is something I want to do with it that just isn't as easy as out-of-the-box. Thanks.

  109. February 25, 2008 @ 9:26 pm #

    @Nazgulled - My suggestion for body CSS

    @oscarml - are you using firebug? Can you inspect the element and see what is there? Is it just hidden? You could try wrapping the response in a div:


    @Michael - you could add something like:

    $myVar = isset($_REQUEST['myVar']) ? $_REQUEST['myVar'] : '';

    Then use $myVar in the script as needed.

  110. February 26, 2008 @ 3:07 am #

    That doesn't fix the Opera problem, you still need to add min-height to body and it doesn't matter if body height is 100% or if the html has 100% height, they don't work alone (for the Opera problem), both, html height and body min-height must be set to 100%, that's the only way that worked on my tests with Opera.

  111. February 26, 2008 @ 5:04 am #

    Hi again Eric,

    Thanks for responding I do really appreciate it. I should have explained better what I was trying to do. In your example index.html file, when you click on the 'button' to launch the modal window, the window opens and loads contact.php which is the contact form. What I wish to do is: when the button is click, pass a unique email address to contact.php form in the modal window. I have 5 different email address and I want the contact form to be able to email according to which one is selected (clicked) to launch the modal. I hope this explains a little better my problem. Thanks again for a great plugin.

  112. February 26, 2008 @ 5:49 am #


    I said this didn´t work:

    var data = $.get(’test_data.html’);

    but if u add and alert("") between both lines, it works. Is a time matter?
    I've tried to use callback parameter, but as it's recursive, i dont know if it's possible:

    var data = $.get('cv.html', function(){

    can u help me?

  113. February 26, 2008 @ 5:52 am #

    I don't know if this is a normal behavior and if it will be gone when you add true support for modal dialogs, but...

    Changing some modal properties (colors, size, etc...) do not retain it's properties after closing. For instance: I have this ajax form where I show a blue modal dialog on the request saying it's processing the form, if something wrong happens with the submission, I change the modal properties to a red popup without closing it first. Then, the user reads the error message and closes the popup, the next popup will still be blue and not retain the red changed properties.

    I just thought that you should know, not sure if this is what you wanted because it took me a while to find out why this was happening and that the "problem" was the way SimpleModal is coded.

    Keep up the good work.

  114. February 26, 2008 @ 5:52 am #

    sorry guys, to many hours coding. This works:

    var data = $.get('test_data.html', function(){

    thx for attending me!

  115. February 26, 2008 @ 7:36 am #

    i try to generate a list dynamically, where several links should open different modals. i tried it like this:

    <a href="$('#term_AAdClickRate').modal();)" rel="nofollow">Ad Click Rate</a>
    Content 1
    <a href="$('#term_AdServer').modal();)" rel="nofollow">Ad Server</a>
    Content 2

    EDIT: Fixed HTML tags (you need to encode the tags - see the information above the reply textarea)

    but this has not the effect i wanted. nothing happens. does anybody have an idea how i can solve my problem?

  116. February 26, 2008 @ 7:40 am #

    The current version does not support multiple dialogs. You'll have to wait for the next version, which may take a whole but Eric can answer you better.

  117. February 26, 2008 @ 7:52 am #

    thank you.

  118. February 26, 2008 @ 9:23 am #

    @Nazgulled - I don't have a body min-height and Opera works fine on the SimpleModal test and demo pages.

    As for your second question...Each time you call modal(), it's going to create a dialog with the default options and any overrides you pass in. I don't know why you expect it to somehow remember the stying you used on a different dialog...that's up to you ;)

    @Michael - Well, I think I would do something like:
    1) Add a parameter on the initial $.get call (contact.js) that indicated which email address to use (I wouldn't use the entire email). Something like:

    $.get("data/contact.php?id=bob", function(data){

    2) Use that "id" parameter to add a hidden field in the contact form with the same values (data/contact.php):

    $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '';
    <input type="hidden" name="id" value="<?php echo $id ?>"/>

    3) When the form is submitted, get the id value again and use that to determine which email to send to.

    I've modified a version data/contact.php with the changes above...give that a try and see if it fits your needs.

    @oscarml - I'm glad you got it working. Did you try my second suggestion?

    @henrik - correct me if I am wrong, but you are not asking for multiple dialogs simultaneously, but the ability to create links for multiple dialogs, right? There is no limitation in SimpleModal for that. The main problem is that your code is incorrect. Try something like:

    <a href="#" onclick="$('#term_AAdClickRate').modal(); return false;">Ad Click Rate</a>
    Content 1
    <a href="#" onclick="$('#term_AdServer').modal(); return false;">Ad Server</a>
    Content 2

    I don't advocate coding this way (using onclick, etc), but I just wanted to show you a working example based on your code.

  119. February 26, 2008 @ 11:45 am #

    Hi Eric,

    yes, the second suggestion worked as well but as long as u put it inside the callback function.

    Now I've a new problem: if the height of html file I want to put is higher than the modal box, it overflows out of the box. Is there any posibility of putting a scroll bar on the right side of the modal box in order to be able to read all the document with no overflow?


  120. February 26, 2008 @ 12:02 pm #

    Wow, you should put an edit mode for the posts, or just "delete ur own post if u are not encourage enough to edit css" hehe.

    Just add "overflow: scroll" to "#modalContainer" class and in "#modalContainer a.modalCloseImg" class change "top:-15px; right:-18px;" for "top:0px; right:0px;" in order not to cover up arrow of scroll control.

    Sorry again for posting before fighting!

  121. February 26, 2008 @ 12:07 pm #

    @oscarml - you might consider adding the overflow property to the div you created with the responseText. Otherwise (depending on your usage), if you put overflow on the container, you'll experience a problem with the close image (if you are using it). Just a thought ;)

  122. February 26, 2008 @ 1:49 pm #

    I downloaded the demo and it didn't work on my local opera without that little tweak. But basically, Opera has that stupid bug. If the page layout doesn't fill the whole area covered by the browser, than it fails to close overlay property. Whatever method fits to anyone to fill up the screen with any html just to make sure everything is covered up, will fix the problem. min-height worked for me :)

    About the other thing, I wasn't expecting SimpleModal to remember anything but I wasn't expecting the other way around either. Basically, I didn't know how it worked and I had a modal dialog opened, then I changed some colors (and the message that it displayed) without closing it, then I closed it, and when I opened a new one, the message from before was there but not the colors. That made me wonder why and it took me a while to figure it out...

  123. February 27, 2008 @ 6:27 pm #

    Hi Eric;

    the only place i have basicModalContent in the below

    $('#testLink').click(function (e) {
    <a href="#">Test</a>

    thank you…..

  124. February 27, 2008 @ 6:59 pm #

    Thank you for timely answer, and sorry for my untimely feedback. Your suggestion for the close function on Feb 4th worked perfectly. I see now I could have figured it out for myself - makes obvious sense. You have provided an excellent plugin, and your support is greatly appreciated.

  125. February 27, 2008 @ 8:57 pm #

    Hey eric.
    Havnt been here in a while. I see you did exactly what i was hoping for, a contactor that works for multiple emails. That will help me out a bunch. But as always, i have a few questions. First, i like to use href links, not an input area to load the contactor, how would u make a link load a contactor for a certain email? and lets say i have 200 emails, does that mean i have to make 200 contact.js's? and is it possible to echo in the contact form when it loads the email or name of the person your about to email? because some emails are stacked on eachother and i wouldnt want someone to click wrong person and not know it.

  126. February 29, 2008 @ 7:12 am #

    @varmısın - If you use the $('#basicModalContent').modal(); statement to open a modal window, you must have something in your DOM with an HTML id of basicModalContent.

    @Lee - I'm glad you find the plugin useful

    @Richard - there are a lot of ways to do this, but you could try something like:

    <a href="/contact" id="bob" class="modalContact">Contact Bob</a>

    In the contact.js, replace what's in $(document).ready(function () { with:

    $('a.modalContact').click(function (e) {
       // load the contact form using ajax
       $.get("data/contact.php?id=" +, function(data){
          // create a modal dialog with the data
             close: false,
             overlayId: 'contactModalOverlay',
             containerId: 'contactModalContainer',
             onClose: contact.close

    That way you can use the HTML id to specify which user the email goes to. For non-javascript users, just just enter the url to your actual contact form in the href of the contact link.

  127. February 29, 2008 @ 2:11 pm #

    looks sweet. ill set it up and test it soon. Last thing i was looking at though. i see how it uses the id feature, and in the contact.php i see in the form , you have an input for the $id but its hidden.
    is there a way for me to in the bottom div (div class bottom) in the form to echo or show the name, or even email (prefer name) of the person u clicked to contact?
    i was thinking if the id is bob, can it stick that text so the bottom of the form would say "you are currently contacting (id_name_here)"
    if thats possible with the coding you have now that would be great. ill play around with it. but if you have to recode something or go out of your way, then ill forget about it. your already very helpful and i appreciate this.

  128. February 29, 2008 @ 3:19 pm #

    Hi Eric...

    This plugin is working perfect for me. This is absolute good and small! Don't stop this job...

    I'm having a problem here... If i use $.modal.close(), this don't use the code especified in onClose. This is a bug?

    Tk's bro

  129. February 29, 2008 @ 3:22 pm #

    I talked "small" in "small size" ok?

    Tks bro

  130. February 29, 2008 @ 3:42 pm #

    i try your code, is more beauty, but I cannot to send e-mail.
    i think there is problem here

    url: 'php/contact.php',
    data: $('#contactModalContainer form').serialize() + '&action=send',
    dataType: 'html',
    complete: function (xhr) {

    why? where's my problem?

  131. March 1, 2008 @ 2:25 am #

    hello eric,

    cool modal, i have question about focus, when i tab at the end of the textbox the focus shift to the background window, is this the correct behavior?

  132. March 1, 2008 @ 9:23 am #

    @Richard - if you use the id from the <a> link method, you'll want to remove the hidden field from the original file I sent you. Then, in the contact form code, you could change the <h1> to be something like:

    <h1 class='title'>Send " . ucfirst($id) . " a message:</h1>

    That's assuming that you use, for example, an id of bob instead of 1.

    @Gabriel - that is the correct behavior. It's to prevent an infinite loop if the $.modal.close() is called from within the onClose callback ;) You could change the SimpleModal source to:

    $.modal.close = function (ext) {
       // call close with the external parameter set to true
       $.modal.impl.close(ext == false ? ext : true);

    Then you can call $.modal.close(false); anywhere you like, as long as it's not from inside your onClose callback.

    @Fabiana - I'd need some more details. Is the contact.php file in a folder called php? What is happening?

    @Ronald - it's not the correct behavior in that a truly modal dialog would not allow that, but it is the correct behavior in that the code does not currently prevent it ;) It's something that I'll be trying to resolve in the next version.

  133. March 1, 2008 @ 3:41 pm #

    well at first i couldnt get it to work, but i removed the commenting tags from the ids in the contact.php and it all works perfectly now.
    thanks so much

  134. March 2, 2008 @ 12:35 am #

    is there any solution to get it work with .scrollable plugin? i want to open new modal with (ex 400x400 px) with scrolled table inside - but there are no scroll bars for such generated table.

    scrollable code works without before .modal call;

    any ideas?


  135. March 2, 2008 @ 12:39 am #

    ups mispelled:

    scrollable code works without SIMPLEMODAL before .modal call;


  136. March 2, 2008 @ 4:11 am #

    @oscarml - you might consider adding the overflow property to the div you created with the responseText. Otherwise (depending on your usage), if you put overflow on the container, you’ll experience a problem with the close image (if you are using it). Just a thought ;)

    Hi Eric,

    I've tried to add overflow: scroll to my div but doesn´t work. The scroll bar appears but it still overflow at the bottom of the container. Other css properties applies ok (background-color for example).

    I've solved the problem with the image placing it on the left side of the upper arrow of the scroll.

    Any suggestion?

  137. March 2, 2008 @ 5:35 pm #

    Can I use SimpleModal to display large content, like an entire HTML page? Will it fit the window to the content and to the browser? Will it display scroll bars?

  138. March 3, 2008 @ 5:29 am #

    Hi Edemilson,

    check all my posts in this page, I wanted the same. To sum up:

    var data = $.get('test_data.html', function(){

    About the other questions, we're discussing about that: I tried putting the propertie overflow: scroll in the container div, but u get problems with the closing image because. You need to move it from behind the scroll upper arrow.

    Eric suggested me putting the overflow property in the div I'm gonna load (html file), but that doesnt work.

    Now, we're waiting for answer ;P

  139. March 3, 2008 @ 6:54 am #

    this seems to be a awesome script!
    but you use the ids content, header and container. exactly the ones i am using. because that are the standard ids for designing a website. therefore its very difficult to get it work correctly because the css overlays my one. heres my suggestion: please use specific idnames for example modalheader, modalcontent!
    best wishes...

  140. March 3, 2008 @ 6:57 am #

    what do you think of a esc key function for escaping the modal dialog? some users are used to it. is that possible in next version?

  141. March 3, 2008 @ 6:58 am #

    and one more sentence: i just deleted your css (header, content) and now it works perfectly :). i just did not read your comments in css and thought your styles are linked to things in js file. sorry for that =)

  142. March 3, 2008 @ 12:12 pm #

    Hi Eric,

    Perfect... Tks for help me! =)

  143. March 3, 2008 @ 12:36 pm #

    @Richard - glad it's working!

    @tom - I'll take a look...

    @oscarml - Try the following CSS:

    .modalData {
       overflow: auto;
       width: 100%;
       height: 100%;

    @Edemilson - SimpleModal does not do any dynamic sizing of the modal dialog have to tell it the dimensions up when you initialize it (or in your CSS). Same with have to apply the overflow property where desired. (See comment above)

    @nicmare - The class and id's are set to modalOverlay, modalContent, modalData, etc...which can also be changed, if desired. As for the ESC/close's on my list of things to add.

  144. March 3, 2008 @ 3:19 pm #

    Hi Eric,

    I have other suggestion :)

    If user click in overlay, on showing modal, the modal close.
    Its simple method to close the modal more faster...

    Tks again

  145. March 3, 2008 @ 3:37 pm #

    @Gabriel - I personally don't like the click-to-close on the overlay, but it would be easy enough to do in the onShow callback (untested):

    onShow: function (dialog) {"click", function (e) {
  146. March 4, 2008 @ 8:51 am #

    Eric, ur suggestion doesn´t work. Anyway, don't worry, is working fine.

    Thx again for such a good plugin.

  147. March 5, 2008 @ 2:43 pm #

    @Eric - Tks Eric, working ok...


    I don't knows if is a bug, but the overlay div don't working correctly in IE6.
    The overlay size is equal content size, not from window (visible) size.


    | |
    | |

    I'm creating a HTML demo for this bug (?) and post this for you later.
    Verify the Simple Modal in IE6, ok?


  148. March 6, 2008 @ 10:05 am #

    @Gabriel - see if this post helps...

  149. March 7, 2008 @ 12:09 pm #

    hi eric,
    im not sure but i guess i found a bug?!
    obviously its not possible to use {close: false}); twice.
    so i want to run test "Modal Function w/ string/HTML - close: false" at least two times on my website because i want to avoid the X on top right. therefore i wanted to format all my overlays with a own close button in the overlaybox. but when i use {close: false}); more than one time, it wont work. whats wrong here?
    on your test site is just one case with {close: false});. did u try two functions with {close: false});? please test it and u will see it wont work anymore :(.

  150. March 7, 2008 @ 12:20 pm #

    damn it, never mind eric! is was (of course) a mistake of mine. d'oh...

  151. March 7, 2008 @ 1:31 pm #


    body {
    color: #333;
    font: 8pt Arial;
    padding: 10px;
    width: 100%;
    height: 100%;
    margin: 0;

    The #modalOverlay use "position: fixed;" and this dont work in IE6. I trying to use expression, used in #modalContainer, but dont have success.

    I used the page with lot of content, and this generate scroolbar. If you down the scroolbar, the overlay isnt fixed (the bug of "position: fixed;").

    Check this, and you see ;)

    I trying to solve this problem, if i do, post this here...


  152. March 7, 2008 @ 3:01 pm #

    @Gabriel - the code in SimpleModal fixes the IE6 issues. The tests page has scrollbars and works fine in IE6, so I'm not sure what is causing your issue.

  153. March 8, 2008 @ 11:39 pm #

    This is exactly what I needed. Strong work!

  154. March 10, 2008 @ 9:33 am #

    I'm trying to display a jQuery accordion ( inside simplemodal.

    It works fine on a mac in Safari or Firefox. But it won't work on WinXP in either FireFox or IE7.

    It looks like the accordion script doesn't get run. I tried using onShow and onOpen to initialise the accordion, but no joy.

    Has anyone managed this?

  155. March 10, 2008 @ 10:05 pm #

    @Paul - I was able to get it working using the onShow callback. I took the HTML code (#list1a) from the accordion demo page, and have the following JS:

    <script type='text/javascript' src='jquery.js'></script>
    <script type='text/javascript' src='jquery.dimensions.js'></script>
    <script type='text/javascript' src='jquery.accordion.js'></script>
    <script type='text/javascript' src='jquery.simplemodal.js'></script>
    <!-- from accordion demo page -->
    <link href='demo.css' type='text/css' rel='stylesheet'></link>
    <!-- simplemodal style -->
    <link href='modal.css' type='text/css' rel='stylesheet'></link>
    <script type='text/javascript'>
    $(document).ready(function () {
       $("#test1").click(function () {
          $("#list1a").modal({onShow: function (dialog) {
             $('#list1a', dialog.content).accordion(); 
  156. March 13, 2008 @ 4:09 am #

    hi eric
    i got a little problem using sM in ie6.
    I'm using it together with cycle Plugin (yes i already asked something about this in the jquery discussion group:).
    problem is: i'm using this function to center images:

    $('#pic2 img').each(function(){
    $(this).css({top: '0px', left: '0px' });
    var t = ($(this).parent().height() - $(this).height()) / 2;
    var l = ($(this).parent().width() - $(this).width()) / 2;
    $(this).css({top: t, left: l });

    and in ie6 the image appear much lower than they should. This is the page i'm working on:

    it's like the container element in sM gets too much higher. any idea?

  157. March 13, 2008 @ 12:14 pm #

    How to set closeimg css values in the options like containerCss?

  158. March 14, 2008 @ 8:06 am #

    @vitto - as I mentioned in the jQuery group, I'm not so sure that it has to do with a plugin, but with the CSS.

    @Helio - there isn't a way to directly set it through the options. You'll have to use external CSS or modify the script.

  159. March 16, 2008 @ 5:18 am #

    Hi, i have been up all night trying to do this, but i just cant. is it possible to use the contact (in the demos section) style and animation, but instead of a contact form, an iframe or something?

    Thanks Scott Campbell.

  160. March 17, 2008 @ 3:02 pm #

    @Scott - you should be able to. What have you tried? What problems are you having?

  161. March 17, 2008 @ 9:14 pm #

    I upgraded to you newer modal, and as always im impressed.
    But what security feature did you add? i though it would be the tabbing issue but its not.

  162. March 18, 2008 @ 8:28 am #

    @Richard - the only thing I've upgraded was the WordPress plugin built on SimpleModal...not SimpleModal itself.

  163. March 19, 2008 @ 5:04 pm #

    simplemodal Error on IE6
    for example if you include your example "contact" into one table as this:

    Contact Form
    A contact form built on SimpleModal. Demonstrates the use of the onOpen, onShow and onClose callbacks, as well as the use of Ajax with SimpleModal.
    To use: Open data/contact.php and modify the $to and $subject values. To enable/disable information about the user, configure the $extra array.

  164. March 19, 2008 @ 5:55 pm #

    @Samuele - I'm not sure I understand your message. What is the error?

  165. March 20, 2008 @ 2:12 am #

    onOpen doesn't work in safari 3.0.4 for win. even in your text example, it doesn't fadeIn the overlay.
    also clicking outside the modal, doesn't close it.
    the 2nd issue i solved by:"click", function (e) {

  166. March 20, 2008 @ 9:27 am #

    @george - thanks for pointing out the Safari issue. It's a known issue with Safari, and there are a few different ways to "fix" it. I'll release a minor update that will resolve the issue.

    As for your second's not a bug or issue...I didn't want clicking outside the modal to close it. But as you posted, it is very simple to add that if you do ;)

  167. March 21, 2008 @ 2:31 pm #

    Below is the page I'm doing as a test. When I click the link, instead of getting a modal, I just see the text "Sample Content Just A String."

    What am I missing?


    <script type="text/javascript" src="contact/js/jquery.js"></script>
    <script type="text/javascript" src='contact/js/jquery.simplemodal.js'></script>
    <script type="text/javascript">
    $(document).ready(function() {
    $("a").click(function (e) {
    $.modal("Sample content just a string");
    <a href="">Click Here</a>

  168. March 22, 2008 @ 12:17 am #


    Very nice work! This is going to make my site look very professional. I have a question for you. I would like to display a questionnaire form using your modal but before I display the form the user must be logged in. So if the user is not logged in I want to display a login form. After the user logs in I want to display the questionnaire form. I want all this done in a modal.

    I am using the jquery get request to check if the user is logged in which works fine. If the user is logged in I show the questionnaire form and if they are not I show a login form. Everything works fine up to this point. The problem happens when I attempt to login using the jquery ajax request in the complete option I want to display either the login form again or the questionnaire form if the login was successful but instead the modal says "sending" with the loading animation. Using FireBug I can see it make a get request to load the questionnaire form when it should be doing that yet. Please hlep. Thanks for your time.

  169. March 23, 2008 @ 7:24 am #

    I'm having troubles trying to get the .get method to work in FF 2.0 and IE7. Works fine in IE6. In FF it doesn't work at all, in IE7 it only loads a portion of the content. Can someone look at the URL and tell me what the issue might be?

  170. March 23, 2008 @ 12:05 pm #

    I have gotten most of it to work. Now my problem is after the user logs in successfully I do another get to retrieve the questionnaire form but the send button doesn't work. I think since the form changes the binding of the click event is reset. I try to bind the click event to the new form but it doesn't seem to work. What could I be doing wrong?

  171. March 24, 2008 @ 8:25 am #

    @Kurt - it looks like you haven't included any of the CSS.

    @Joe - without seeing any code (do you have a link?), it's pretty tough to know what the issue could be...

    @Clint - to get the url (why not just use the href?), try:

  172. March 25, 2008 @ 9:19 pm #

    why it is not possible to nested modal window?I think the nested modal window is very important and very useful

  173. March 26, 2008 @ 10:23 am #


    I figured it out. I probably would have never figured it out without Firebug. Thanks for taking the time to respond and for making this cool modal.


  174. March 26, 2008 @ 11:38 am #

    @hotcicada - nested modal windows is a feature that I'm working on...

    @Joe - glad you got it figured out! I don't know how I ever did web development without Firebug! ;)

  175. March 28, 2008 @ 10:32 am #

    i use this nice plugin for showing errors on my little app, now the problem os that there might be too many errors, which are not completly fit in the dialog.
    is there a way of adding some sort of scrollbar to the dialog?

  176. March 28, 2008 @ 1:32 pm #

    I see in the code that there is a "Stand-alone close function to close the modal dialog". However, I seem to have problems calling this function. It is easier for me to handle the event that could cause a close and close myself than to use the "modalClose" implementation. An example of how to call close() would be helpful for me.

    I simply create a dialog like this:
    $(strElId).modal(); //where strElId is string that contains the id of my element (this works fine, I see the dialog)

    Here are attempts for closing that don't work:

  177. April 1, 2008 @ 10:52 pm #

    @Michael - you should be able to just add overlay: auto to the CSS for the content you are placing in the modal dialog.

    @Karim - in the current version, you just need to call $.modal.close();. See this post.

  178. April 3, 2008 @ 5:20 am #

    I using SimpleModal 1.1.1 and jQuery 1.2.3 to play YouTube-videos. It works perfect in Opera, Firefox, and Safari. But i have big problems i IE6 and IE7, and don't know what i am doing wrong.

    In IE6 nothing happens visually, but the sound is there, so i can hear the video playing in the background.

    In IE7, the overlay works good, but i get double playback of the sound, that means two copys of the video (the sound) are playing at the same time, but visually only one video is displaying.

    Her is an example of the code:

    <object width="475" height="400">
    <param name="movie" value="URLtoYouTUbe" />
    <param name="wmode" value="transparent" />
    <embed src="URLtoYouTUbe&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" width="475" height="400" />

    Her is my CSS:

    padding:4px 0 4px 0;
    border:4px solid #ccc;}
    #modalContainer a.modalCloseImg{background:url(x.png) no-repeat;

    Here is my custom JavaScript:

    jQuery(function() {
    jQuery('a.gluggjs').click(function() {
    jQuery.get(this.href, {}, function(data) {
    onClose : function() {
    jQuery('#modalOverlay').css('background-color', '#40566a');
    return false;

    And i have both jQuery 1.2.3 and SimpleModal 1.1.1 in the head-element of my HTML.

    I would be very grateful for any help. You can also contact me at my email. I can pay you for any help on this issue. Thanks!

  179. April 3, 2008 @ 10:25 am #

    Great modal!

    Could you publish a demo or code for simply loading an external html page into the modal (for those of us who want to use your script but don't understand jquery.)

    I tried to follow the discussion here but got lost.

  180. April 3, 2008 @ 3:08 pm #

    @artguy101 - check out the contact demo. It contains a lot of extra "stuff" but it does exactly what you mention. It loads the HTML content for the contact form via an Ajax call.

  181. April 4, 2008 @ 3:31 am #

    Thanks for the quick reply, Eric. I tried altering contact.js to just display an .html file (and a .php one) but I'm not making it work. Does anyone have a link to an example?

    Also, can simplemodal work from inside joomla? My situation is complicated because I'm using dynamic drive's ajax script to load external pages into joomla content. Modals that use class="modalboxname" work, but not ones that use rel="modalboxname"

  182. April 5, 2008 @ 11:02 am #

    i click "send",but "Unfortunately, your message could not be delivered."

  183. April 7, 2008 @ 10:03 am #

    @artguy101 - something like the following should work:

    <script type="text/javascript">
    $(document).ready(function () {
    	$('#ajax').click(function (e) {
    		$.get('data.html', function (data) {
    <a href='#' id='ajax'>test</a>

    @yobin - can you be more specific? Are you talking about an issue on my site or with code you are working on?

  184. April 10, 2008 @ 6:08 pm #

    Hi Eric, I am using the code from the confirm example, but I want to use it on only one form that I have on a page. It works for that form, but now whenever a I use a standard JS confirm dialog on other parts of the page, the SimpleModal window pops up as well as the JS dialog. Is there any way I can prevent this?

  185. April 11, 2008 @ 1:49 am #

    To clarify my comment (permalink to comment): The problem is only visible when i use &autoplay=1" in the YouTube-URL. When i don't let it autostart and the user must click on the video to play it, then it is OK in IE7. In IE6 the problem persist, but i don't need to support IE6, only IE7.

  186. April 11, 2008 @ 2:54 am #


    Just wanted to say thanks for this plugin. Nice work !


  187. April 12, 2008 @ 12:35 am #

    Hi Eric:
    I used SimpleModal demo. It works perfect in IE6,But i have big problems in Firefox2.0, and don't know what i am doing wrong.

    error infomation:

    uncaught exception: [Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://localhost:8080/havaatry/js/jquery.js :: anonymous :: line 23" data: no]
    can you help me?

  188. April 12, 2008 @ 12:38 am #


    Contact Form

  189. April 12, 2008 @ 3:44 pm #

    Hi Eric,
    thanks for this very helpfull and nice plugin!.

    Working on IE 6 & 7, quirks mode, I applied the patch as described in IE7 quirks mode hack. I ended needing to manipulate #modalOverlay.height since #modalOverlay and #modalContainer go away when scrolling vertically, so I set

    #modalOverlay {
    height: 300%;

    but the plugin forces #modalOverlay.height to 100%. It would be nice if the plugin code honors all property´s value setted from css, or .modal() options.

  190. April 14, 2008 @ 11:39 am #

    @Michael - try renaming the function to something other than confirm.

    @Asle - interesting. When I have some free time, I'll try to see if I can figure out what is going on.

    @Gildas - thanks!

    @Druid - it's hard to say what the issue could be without seeing any code.

    @Patrick - the next version should handle these types of issues better.

  191. April 15, 2008 @ 12:44 am #

    i download the Contact Form demo which is in the SimpleModal demo;i run it in localhost.ie6 no problem ,problems in Firefox2.0.I did not change any code what was download from your website.Thanks for your help.

    error infomation:

    uncaught exception: [Exception… “Could not convert JavaScript argument” nsresult: “0×80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)” location: “JS frame :: http://localhost:8080/havaatry/js/jquery.js :: anonymous :: line 23″ data: no]

  192. April 15, 2008 @ 12:47 am #

    the code i download from

    Contact Form

  193. April 15, 2008 @ 6:05 am #

    Hello Eric. Now i am using SWFObject to play the YouTube videos inside SimpleModal overlay, and that completely solved my problems. Now it works perfect in IE6, IE7, Safari, Opera and Firefox – so i don't need a solution to this anymore. Thanks! (PS! SimpleModal is great, thanks!)

  194. April 16, 2008 @ 2:31 am #

    Thanks Eric, that worked a treat.. i guess i was looking a little too hard to not see that myself! =]

  195. April 18, 2008 @ 1:19 am #


    First of all, congratulations for the script.

    Second, I'm using the Contact Form. My form has to send a file, something like:

    but ther's noway to send the file. Somebody can help me?

    Thank you in advance!

  196. April 18, 2008 @ 1:20 am #

    Dave Again,

    the form does not appear in my last post. It's just a form with a file input


  197. April 18, 2008 @ 7:05 pm #

    I had this error also in the download of contact form

    error information:

    uncaught exception: [Exception… “Could not convert JavaScript argument” nsresult: “0×80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)” location: “JS frame ::......

  198. April 19, 2008 @ 4:49 am #

    Hello JP and Druid,

    had the same problem:
    uncaught exception: [Exception… “Could not convert JavaScript argument” nsresult: “0×80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)”

    my solution was: not just simply click on the "index.html" which you have downloaded in the directory contact! You have to run it on a real webserver because php can only work on a webserver (i.e. install xampp on a testmachine).

    Hope this solves your problem too.

  199. April 19, 2008 @ 7:15 am #

    To all having the NS_ERROR_XPC_BAD_CONVERT_JS issue - The contact form demo uses Ajax and PHP - which means it needs to be served through a web server in order to work (as mentioned by manfred).

    @Asle - thanks! I'll check out that library and see if there is anything that I can add into SimpleModal.

    @Dave - you'd have to not only add the input on the form, you'd also have to code contact.php to handle the file and attach it. See File Attachments on

  200. April 25, 2008 @ 2:06 am #

    @Eric Martin = Thanks for your solution :) Dave

  201. April 26, 2008 @ 6:33 am #

    Eric: Great piece of code, but the lack of a show() method is a show stopper. I need to show the modal programmatically via a JavaScript function. So a second vote for a show() function.

  202. April 26, 2008 @ 8:05 am #

    @Greg - the new version will have ability to open and close the modal dialog programmatically...stay tuned! ;)

  203. April 29, 2008 @ 9:00 am #


    I downloaded the demo "contact" ( and I have a problem.

    What happens is that the first time I click on the popup link, the modal dialog fades in.. upon closing it, it fades out just fine too. But then on, if I click again on the button it simply refuses to show anymore.

    In IE6, the javascript error "" appears :

    Line : 137
    Char : 7
    Error : '$.modal' is null or not an object
    Code 0
    URL: http://...

    The source code is the same that in the demo. It seems there is a problem here :

    close: function (dialog) {
    		$('#contact-container .contact-message').fadeOut();
    		$('#contact-container .contact-title').html('Fermeture...');
    		$('#contact-container form').fadeOut(200);
    		$('#contact-container .contact-content').animate({
    			height: 40
    		}, function () {, function () {
    				dialog.container.fadeOut(200, function () {
    					dialog.overlay.fadeOut(200, function () {

    Please, could you help me?

  204. May 2, 2008 @ 11:57 am #

    Hello All,

    I have solved my problem : I used many JS files and there was a conflict between these files.

  205. May 3, 2008 @ 5:51 am #

    Hey great script.
    Just one question.
    How can I get the modal box to display on page load?
    Thanks & great job!

  206. May 3, 2008 @ 2:03 pm #

    @Oliver - glad you got it resolved!

    @Ajay - Try:

    $(document).ready(function () {
  207. May 3, 2008 @ 7:15 pm #

    Thanks for the great script - its fantastic.

    I've run into an Internet explorer problem. I'm using the following code in a series of links to call the answers FAQs in your simplemodal. The html links are:


    <li><a href="/faq1.php/" id="faq1">How does this work?</a></li>
    <li><a href="/faq2.php/" id="faq2">How much does it cost</a></li>
    <li><a href="/faq3.php/" id="faq3">Can I resell it?</a></li>
    <li><a href="/faq4.php/" id="faq4">How do you handle return?</a></li>
    <li><a href="/faq5.php/" id="faq5">Do you have an affiliate program?</a></li>


    and the javascript is:

    $(document).ready(function () {

    $('#faq1').click(function (e) {
    $.get('/faq1.php/', function (data) {

    $('#faq2').click(function (e) {
    $.get('/faq2.php/', function (data) {

    $('#faq3').click(function (e) {
    $.get('/faq3.php/', function (data) {

    $('#faq4').click(function (e) {
    $.get('/faq4.php/', function (data) {

    $('#faq5').click(function (e) {
    $.get('/faq5.php/', function (data) {

    Any one of the links open nicely the first time, however after closing the modal window (clicking the X icon) a javascript error occurs and the other links will not open. The error message using FirebugLite is (I'm not sure how to diagnose javascript errors in IE):

    Object doesn't support this property or method (line 49)

    But the line number changes depending on which of the five links you click.

    This does not happen in Firefox (which is why it took so long to discover my mistake). In fact it works beautifully in Firefox.

    All is this is based solely on your Basic demo - and the advice you gave here on how to open a file instead of text in a div. I haven't changed the CCS or the simplemodal.jquery.js or jquery.js at all.

    I am running this in a wordpress background - I'm not sure that that matters. I thought that it was a problem with making to many calls on one page - but it works great with Firefox - so it seems like its a IE thing. Any help would be greatly appreciated.

  208. May 3, 2008 @ 7:35 pm #

    I enabled script debugging in IE and found that IE is getting hung up on $.modal(data); in the following javascript. On this particular page I have five links that use similar blocks of this code (just changed for the particular FAQ its requesting). This is why the error is on a different line depending on which link you select. The error just moves to the appropriate javascript line but it is always $.modeal(data).

    $('#faq5').click(function (e) {
    $.get('/faq5.php/', function (data) {

    I really appreciate any help you could offer.

  209. May 3, 2008 @ 9:14 pm #

    Eric - thank you for your fine work here. I diagnosed the error - it was on my end. I failed to delete wordpress' wp-footer function with placed your smcf javascript into the document. This resulted in a conflict that Firefox could resolve but IE couldn't. It was clear that the problem was with my document given that $.modal(data) was the hang up. So I looked at the page source that wordpress kicked out and found your smcf output on a page that didn't call for it. I eliminated the wordpress function from the FAQ page template and I was golden.

    I works beautifully. Thank you - you're a genius. Where is your donation page?

  210. May 5, 2008 @ 2:45 am #

    Hello Eric,

    Is there a way to get the same window as in your demo called "Contact" but with the treatment that you can see here :

    I would say that I would like to use your simple modal but when I click on submit, I would like the data are written in the window which contain the button which allows to open your simple modal.

    Thank you very much for your help.

  211. May 5, 2008 @ 5:39 am #

    Hi Eric, love the script.
    Is there a way to place a YouTube embedded video in the modal?
    I added the object doe from youtube to a "div" and made it modal, Firefox works, but IE7 gives an error.
    Beating my head against a wall trying to figure it out.

    Would your solution also work for google maps?


    Sample code -

  212. May 5, 2008 @ 5:40 am #

    Sorry, here's the code

    <div id="videobox" class="videocontainer" style='display:none'>
    <table border="0" cellpadding="8" cellspacing="0" width="600" height="406" background="images/fav-yellow-grad.gif">
    <tr><td valign="top">
    <object width="425" height="355">
    <param name="movie" value=""></param&gt;
    <param name="wmode" value="transparent"></param>
    <embed src="; type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed>

  213. May 6, 2008 @ 10:59 am #

    Hi Eric, really nice plugin. I have a problem, i hacve spent a much time, i want to put an image inside of the simplemodal. I don't know the image size so I can't center it.
    I've been tring a code like this:

    $('a#test3').click(function (e) {

    and a CSS similar,
    #modalContainer {height:auto; width:auto; margin-left:auto; margin-right:auto; background-color:#fff; border:3px solid #ccc;}

  214. May 7, 2008 @ 12:31 am #

    Hi Eric, I'm afraid my last post was incomplete, (I forgot <code> tags :-))

    Thank You, Daniel.

    it's suppose to be:

    $(’a#test3′).click(function (e) {

  215. May 8, 2008 @ 8:06 am #

    @DPF - do you have a link I can view?

    @Dan - I haven't tried placing a YouTube video inside or google maps. If I have some time, I'll give it a try.

    @Daniel - I'm not sure what you are asking. I don't know what you are trying to do with $('').modal();. Please clarify so I can help...

  216. May 8, 2008 @ 10:00 am #

    My last post has disappeared, I don't know what has appened. What I want to do is put an image inside the simplemodal, I don't know the size of the fotograph so I have problems to center it.

    Thank for atend my post (Sorry for my disgustin English)

    this the code:
    $('a#test3').click(function (e) {
    $('<div id=\'container\'><img src=\'\' /></div>').modal();

  217. May 8, 2008 @ 10:29 am #

    Is it possible to use SimpleModal to show a modal window overtop of a certain block element on the page (such as a div) without blocking the whole page?

  218. May 11, 2008 @ 9:47 am #

    this is roddic again
    my last post has been disappeared.How will i will add extra form property(like enctype="multipart/form-data") in this contactus form....

  219. May 11, 2008 @ 10:04 pm #

    I have the same problem like roddic.
    I just want to use this simple modal contact form for image upload .Is it possible to upload image or any file using this modal window.

  220. May 12, 2008 @ 1:42 pm #

    Hi Eric
    Great plugin you made, but i have one question about using phpmailer.
    I'm not using english characters, so i become strange chars on my email.
    So, i have added this to Build header:

    $header .= "Content-Type: text/html; charset="charset=utf-8"";

    And this didn't help.
    Any suggestions? i would like to use utf-8 charset encoding.

  221. May 12, 2008 @ 3:08 pm #


    I have solved thid encoding problem.
    You have to change contact.php and add this lines to Build header.

    // Build header
    $header = "From: $email\n";
    // add
    $header .= "Content-Type: text/plain; charset='utf-8'; format=flowed\n"
    . "MIME-Version: 1.0\n"
    . "Content-Transfer-Encoding: 8bit\n"
    . "X-Mailer: PHP\n";

  222. May 15, 2008 @ 3:25 am #

    That's real good job !!!
    Just one little question from a 'beginner" :

    When using simpleModal, is it possible to "open" the "modal window" by clicking on a picture instead of a "Demo" (or other !) Button ?

    Thanks a lot

  223. May 15, 2008 @ 5:22 am #

    Hi Eric

    How to increase the height of the container dynamically?.

    I am using external style sheet to define the styles to the container. I am adding DOM elements dynamically(say for some condition) to the modal .So while adding the
    DOM elements to the modal i want to increase the height of the container.How can i do it.Thanks in advance

  224. May 19, 2008 @ 10:20 am #

    @Daniel - I would manually load the image and then determine its dimensions in order to center it within the dialog. Something like (untested):

    var i = new Image();
    i.src = '';
    $(i).load(function () {
        // determine dimensions of i
        var w = $(i).width();
        var h = $(i).height();
        // use this values to center the image in the dialog

    @Adam - SimpleModal is currently only for page blocking, not element blocking. I've thought about adding that feature, but for now, I'd suggest using BlockUI.

    @roddic, RNS - I don't see any reason why you couldn't use a dialog to as an upload form...

    @Saso - I haven't added it into the Contact demo yet, but I added a UTF-8 support in SMCF. I'll be adding it into the Contact demo soon.

    @Hervé - you can open a modal however you like ;)

    $('img').click(function () {

    @BenkiBirugaali - you'd probably want to use one of the callbacks and just re-set the CSS values:

    onShow: function (dialog) {
        // increase the dimensions of the container
            height: newHeight,
            width: newWidth
  225. May 20, 2008 @ 2:10 am #

    Thank you Eric.

  226. May 20, 2008 @ 5:43 am #

    Thanks a lot Eric,

  227. May 20, 2008 @ 11:06 am #

    Eric - Thanks for answering my first question.

    Do you have any examples of a way to create a modal window that can be moved around the screen to different areas and resized?

  228. May 21, 2008 @ 4:58 am #

    I want the content inside simple modal to be scrollable. I tried adding

    { overflow:scroll;}

    I get scrolllbar, but X image is getting clipped, Can you suggest some alternatives?

  229. May 21, 2008 @ 9:47 am #


    This one really a good plugin.

    I have a question ( maybe stupid one ) is that I follow the instruction and
    setup the contact form ( demo one ) and it is work fine. but once if I make
    any change of the contact.php, it seems didn't sync back when call it again.

    only if I clear IE's cache, it will be fine. so is it an issue of ajax?
    or any alternative way to slove this issue?


  230. May 21, 2008 @ 12:22 pm #

    Thanks a lot, Eric

  231. May 22, 2008 @ 1:47 am #

    Hi Eric,

    Can I have some hint that if I want to modify this contact demo form furthermore? ie currently inside contact.js, xhr.responseText will contains the returned html from contact.php's output, so how about if I want to use this xhr.responseText result set to create a new modal inside the current modal window? as I want use it as a master-detail input form purpose. so once user input login and successful, it will retreive related data in the same modal screen.

    for example, if

    xhr.responseText contains serval other input field ( kinda same css defination ) for user interact, so if create a new modal, something like that?

    close: false,
    overlayId: 'contact-overlay',
    containerId: 'contact-container',
    onClose: contact.close

    I have no idea at all how to archive it, appreicate for any hints.


  232. May 22, 2008 @ 5:27 pm #


    This is a real nice plugin. Unfrtuanately it doesn't work with Jquery 1.1.2. Has anyone found any solution for this? I really like to use this plugin. However in IE 6 it is appearing all the way to the down (left) and the close button (X) at the top.


  233. May 22, 2008 @ 9:17 pm #

    @Adam - I haven't tried implementing any sort of draggable/resizable dialog yet. You could always try the UI libraries for that...and could even use the dialog library which should have PNP support for those features.

    @Gaurav - I'd suggest putting the overflow property on the data itself and not the container.

    @Davis -
    #1: Since the $.get function doesn't allows for the cache property, you could try adding a "timestamp" to the URL to make it unique. For example, in contact.js, change:

    $.get("data/contact.php", function(data){


    $.get("data/contact.php?ts=" + (new Date()).getTime(), function(data){

    #2: Currently SimpleModal does not support multiple dialogs at the same time. However, the new version I am working on will support it.

    @JqCoder - I've tested it with 1.1.2 and not had any issues. If you are talking about the contact form, then you are correct, it uses animation functions that aren't available in 1.1.2. What is preventing you from upgrading jQuery? As for your IE6 issue, is this an issue on one of your pages or one of the demo/test pages?

  234. May 22, 2008 @ 11:44 pm #

    Hi Eric,

    Thanks for your hints.

    for #2, i have a workaround temporary now as ...

    close current modal window, then popup/create a new one immediately ( with retreived xhr.responseText's data ).

    now all i tested in IE7 only and fine, but once try in FF2, it got an error

    uncaught exception: [Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://localhost/icanchat/javascript/jquery/jquery-1.2.3.pack.js :: anonymous :: line 11" data: no]

    im using jquery-1.2.3 & SimpleModal 1.1.1

    so any idea about it?


  235. May 23, 2008 @ 12:08 am #

    Hi Eric,

    Please ignore previous error issue, i found where caused it.


  236. May 23, 2008 @ 1:51 am #

    Hi Eric,

    I found the error generated due to php program fail to return html output.
    as Im using php + smarty template build for my website, so in this case

    inside contact.php
    $t->display( 'contact.tpl' );

    which contact.tpl file will included all html that I want to output to modal.

    the problem it seems that smarty function not work at all in FF2 in this suitation. ie $.get() -> php -> smarty template function, but fine in IE browser.

    so if any comment about this issue will be much appreciated.


  237. May 23, 2008 @ 2:25 am #


    The script works great for me. I have just starting testing in firefox 3, and the dialog seems to show behind any flash on the main page. Is this a know issue? Are there any easy workarounds?


  238. May 23, 2008 @ 8:46 am #


    sorry, it must be lot of coding and make myself crazy...)
    previous error due to something wrong of the tpl ( template file ) only hit in FF2, now sloved.. sorry again if bother you look at it.


  239. May 24, 2008 @ 12:33 am #

    The following changes seem to keep the dialog infront of flash videos for firefox 3. Not sure if this is the best way to do it, but it seems to work for me.

    // fix issues with IE and create an iframe
    if ($.browser.msie && ($.browser.version < 7)) {
    if ($.browser.mozilla && ($.browser.version >= 1.9)) {

    and a bit further down....

     * Fix issues in IE 6
    fixIE: function () {
       var wHeight = $(document.body).height() + 'px';
       var wWidth = $(document.body).width() + 'px';
       // position hacks
       this.dialog.overlay.css({position: 'absolute', height: wHeight, width: wWidth});
       this.dialog.container.css({position: 'absolute'});
       this.addIFrame(wHeight, wWidth);
     * Fix issues in FF 3
    fixFF3: function () {
       var wHeight = $(document.body).height() + 'px';
       var wWidth = $(document.body).width() + 'px';
       this.addIFrame(wHeight, wWidth);
     * Add iframe
    addIFrame: function (wHeight, wWidth) {
       // add an iframe to prevent select options from bleeding through
       this.dialog.iframe = $('<iframe src="javascript:false;">')
          .css($.extend(this.opts.iframeCss, {
             opacity: 0, 
             position: 'absolute',
             height: wHeight,
             width: wWidth,
             zIndex: 1000,
             width: '100%',
             top: 0,
             left: 0

    EDIT (Eric): added missing + operators and formatted code

  240. May 26, 2008 @ 7:10 am #


    I am using contact demo for some more modification and got a problem to seek anyone help. thanks in advance.

    I got a markup with contact.php will process this input file, as usual this contact.php call by $.ajax()

    if( is_uploaded_file( $_FILES['imgfile']['tmp_name'] ) )
    { babaababab }

    but don't know why php is_uploaded_file() returned fail. i call $.ajax with following, is it somthing need to set for it?

    url: 'contact.php?ts=' + (new Date()).getTime(),
    data: $('#contact-container form').serialize(),
    type: 'post',
    cache: false,
    dataType: 'html',
    complete: function (xhr) { ... }


  241. May 26, 2008 @ 7:13 am #

    oops..btw, markup just a simple file type with name='imgfile'

  242. May 27, 2008 @ 9:11 am #


    I have one problem in IE7... Why script working slowly than necessary?

    function modalOpen (dialog) {
    dialog.overlay.fadeIn('slow', function () {
    dialog.container.fadeIn('slow', function () {'slow');

    And after 'modalOpen', memory usage up from 50mb to 80mb?

    Sorry for my english. thx.

  243. May 27, 2008 @ 9:32 am #

    I'll have to use that on my own projects. Thanks for the jquery box.

  244. May 27, 2008 @ 10:32 pm #

    How does this get around the bug in Firefox where textboxes have no cursor inside a modal dialog?

  245. May 29, 2008 @ 8:22 am #

    @Peter - thanks for the suggested code fix. When I have some time, I'll look into it further.

    @Davis - glad you got your first issue worked out ;) As for the upload issue, in reading the PHP docs for is_uploaded_file, it looks like it only works for a HTTP POST. Even though you have type: 'post',, the fact that you are adding values to the query string (GET) might be causing an issue. Try changing that back to just url: 'data/contact.php', and see if that works.

    @Konstantin - I can't reproduce the issue that you describe. Is it happening on one of my pages or on something you've coded?

    @Dobes - what version of FF are you using? I'm using and I don't have any issues with the cursor. I do remember running into this issue, but can't remember exactly what I had to do to fix it :(

  246. May 29, 2008 @ 10:04 am #

    Hi eric,

    Followed what your suggestion, but no luck..:(
    I got another text input field inside the same form, no problem at all can access it by $_POST in either url: data/contact.php or contact.php?ts=.... way, strange?

    in general, inside a form definition, it supposed should include , is it possible
    for the ajax dataType: 'html' issue? also tried set to 'multipart/form-data', also no luck.


  247. May 29, 2008 @ 10:07 am #

    I meant 'multipart/form-data’ in general will include in a form if any input file type included. Thanks/Davis.

  248. May 29, 2008 @ 12:20 pm #

    @Eric - Thanks for thinking about it - I guess I'll take a look at the code and see if I can figure out what you did.

  249. May 30, 2008 @ 3:29 am #

    Hi, great plugin.

    I have one question. Is it possible to put some css for overlay to make shadow ? Currently I'm using modified by myself thickbox plugin to achieve this effect but your plugin looks better and if I could achieve shadow for overlay it would be great.

  250. May 30, 2008 @ 7:52 am #

    Hi Eric,

    As somebody reported that $.ajax didnt support file upload inside a form, but jquery.form plugin did support it, so i have try to call in this way, and need help how to activate it..:)

    show: function (dialog) {
    $('#contact-container .contact-login').click(function (e) {
    $('#cool').ajaxForm( {
    success: function () { alert('x');}});

    a form with id='cool', but why nothing happen when that submit button being clicked?


  251. May 30, 2008 @ 10:33 am #


    I have fixed file upload issue using ajaxform, pretty cool jquery plugin.
    Thanks for all your help.

  252. May 31, 2008 @ 3:05 am #

    Hi Eric,

    Firstly, Excellent plugin !

    I am using the contact form to retrieve a users email address. However I want to call this form repeatedly to retrieve different email addresses. Is there any way I can pass in the (email) text field which I want to populate with the value entered on the simple modal contact form? Otherwise I will have to duplicate the javascript code for the form each time I want to retrieve a different email address.

  253. May 31, 2008 @ 4:19 am #


    I want to use this on multiple links on the same page displaying different content inside the box each time. How would I do this?

  254. June 2, 2008 @ 10:40 am #

    You should really change the CSS that tells the mouse to use the wait cursor—I always think that its locking up the browser! And in Opera the close button doesn't load so I have no way to close it =[

  255. June 2, 2008 @ 11:30 am #

    I'm having a problem with IE6 and IE7. For whatever reason, when I set the modal box to display:none; it causes my background graphic in the div to disappear. When I take out the "display:none" it works fine, but then the div shows at the bottom of the screen. Any ideas?

  256. June 2, 2008 @ 11:41 am #

    @Davis - glad you got it working ;)

    @Dobes - Here are a couple links about the issue:

    I think my demo's and test's don't have the issue, so it should just be a matter of tweaking your CSS.

    @Bastor - I don't have anything built-in, but there are certainly plenty of jQuery shadow plugins available:

    @bubbles - there have been others that have asked a similar question. I've given some ideas above...but basically, you'd have to modify the JS file to look for the address or identifier from the link itself.

    @James - wire up a modal call for each link...see the tests for examples. If this is not what you are asking, let me know.

    @Kevin - 1) if you don't like the cursor, feel free to change it ;) 2) Are you referring to pages on my site or your own? When I view the demos and tests in Opera 9.25, I see the close icon.

    The beauty of SimpleModal is that you can very easily modify any of these behaviors to fit your needs.

  257. June 3, 2008 @ 2:58 am #

    Love the contact form.

    … But. When I Download The Contact form to my machine, it won't open when i click the button. The background fades down but the contact form won't show up.

    Im new to this, is there anything, that I maybe have forgot to install? (work on mac 10.4.9 with firefox and safari)

  258. June 3, 2008 @ 6:09 pm #

    hi, i'n new to al this .jquery stuff, i'm trying to get a working contact for in wordpress 2.5 i downloaded, and activated the plugin, everything goes well, but y don't get the mail form windows when i click the link, i just get a not found message, i just want a simple contact form that pops up, what am i doing wrong? can someone help me with this?

  259. June 9, 2008 @ 8:07 am #

    thank for your great piece of code.
    I'm currently using it with success in a page of my site, but I've a problem with another one, occuring only in IE7.

    The source code for a test page reproducing the error is the follow:


    Pagina di prova con popup

    function avviaPopup(){

    Every time I try to open the page, IE7 complains about an error on line 19.
    I'm not able to overtake this problem, can you help me on this issue ?

    Thank you,

  260. June 16, 2008 @ 5:49 pm #

    Eric, your plugin is awesome. It's helped me learned a lot about JS and jQuery in general.

    Got a question (for both Eric and anyone else who might know). In IE8, when I call modal(), the background opacity is complete no matter what I set it at. I've tried this with a couple of other jQuery plugins and had the same result. Is this something deeper in the framework that is causing this or a bug of IE8 with modals?

    I went to Facebook to see if it was affecting all modals, and it was not.

    If anyone has any insights into this problem, let me know!


  261. June 19, 2008 @ 3:40 am #


    That code help me to solve my problem.

    body {
    background: url('/images/spacer.gif') no-repeat;
    background-attachment: fixed;

    In IE script working not so fast than in FF, but better and faster, than earlier.


  262. June 20, 2008 @ 10:26 am #

    I am writing a page that appears in an iframe within another page. The iframe with my page usually has a scroll bar. The top window does not. I'd like to have an overlay cover the document in top window instead of the document within the iframe. I can insert a div in the top frame like this:

    var overlayDiv = jQuery("#srgModalOverlay", top.document);
    if(overlayDiv == null)
    jQuery("div#portalOuterContainer", top.document).append("\n\n");
    else if(overlayDiv.length == 0)
    jQuery("div#portalOuterContainer", top.document).append("\n\n");

    From my document, is there a way to launch the modal dialog in the document that contains the iframe?



  263. June 20, 2008 @ 10:31 am #

    Sorry. Here's the code:

    var overlayDiv = jQuery("#srgModalOverlay", top.document);
    if(overlayDiv == null || overlayDiv.length == 0)
    jQuery("div#portalOuterContainer", top.document).append("\n<div id='srgModalOverlay'></div>\n");

  264. June 20, 2008 @ 11:49 pm #

    Hi Eric,

    Thanks for the plugin. Very nice work! I have implemented it on a page with a flash movie. I am using the CSS for the contact form dialog. When the modal box appears it is below the SWF. I set the z-index of the swf to -999 but it still shows up below the movie. Do you know happen to know a fix?

  265. June 21, 2008 @ 12:04 am #

    Also, is there a way to dynamically load the script that controls the dialog (contact.js for example) on a button click instead of loading each .js file on initial page load?


  266. June 21, 2008 @ 12:58 am #

    Hi!!!, I have a problem with Browser IE 7, efect appears in FIREFOX 3.0 but not in IE 7, what is the problem, please help me.

    IE 7 show contact form fast, and appear horizontal barr, I don't understant

  267. June 21, 2008 @ 5:54 pm #

    @all - sorry for the lack of responses...between work and a week long vacation, I've been a little busy ;)

    After this, I'll be closing the comments on this page. For support, you can use the jQuery mailing-list or contact me directly.

    @Andes - you shouldn't have to install anything, but it does need to be used through a web server, as

    it makes an Ajax call to a PHP file. I've seen the issue you are talking about with the WordPress SMCF plugin, but not with the Contact Demo. If you have a link that I can view, let me know.

    @Armando - sounds like something is not setup correctly. I tried to view the link, but the site doesn't appear to be up.

    @denis - sounds like an issue with your code. Could be a conflict or any number of things, but without seeing what you have, it's hard to tell.

    @Simon C - thanks! As for the IE8 issue, it looks like it might be an issue with the jQuery opacity function, but I haven't had time to look into it any further. Since IE8 is in early beta, I wouldn't worry about it too much...I'm sure either IE or jQuery will get it sorted out ;)

    @Konstantin - interesting. Sounds like it's maybe an issue with something on your site?

    @Jim - if I understand you correctly, you'd probably have to modify the code to accept an "option" of where to append the overlay (and/or iframe). For example (untested), you could call SimpleModal with:

    $.modal({target: selector})

    And then modify the src, changing the following part in the this.dialog.overlay and this.dialog.iframe .appendTo('body'); to:

    .appendTo( ? : 'body')

    @Shawn - try using SWFObject like Asle did. To your second question, have you tried $.getScript?

    @Percy - do you have a link? It sounds like an issue with your site/code...

Leave a Comment

Sorry, comments are closed. You can contact me directly, if you like.

Eric Martin